[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH libvirt-glib] Avoid triggering deprecation warnings on newest GLib



I haven't tested it but it looks good, so ACK

Christophe

On Wed, Feb 15, 2012 at 12:10:27PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> ---
>  libvirt-glib/libvirt-glib-event.c         |    4 ++++
>  libvirt-glib/libvirt-glib-main.c          |    4 ++++
>  libvirt-gobject/libvirt-gobject-compat.h  |    5 +++++
>  libvirt-gobject/libvirt-gobject-manager.c |    1 +
>  4 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c
> index c1761e8..6d54b10 100644
> --- a/libvirt-glib/libvirt-glib-event.c
> +++ b/libvirt-glib/libvirt-glib-event.c
> @@ -31,6 +31,10 @@
>  
>  #include "libvirt-glib/libvirt-glib.h"
>  
> +#if GLIB_CHECK_VERSION(2, 31, 0)
> +#define g_mutex_new() g_new0(GMutex, 1)
> +#endif
> +
>  struct gvir_event_handle
>  {
>      int watch;
> diff --git a/libvirt-glib/libvirt-glib-main.c b/libvirt-glib/libvirt-glib-main.c
> index 8f50cc8..0cb2dd5 100644
> --- a/libvirt-glib/libvirt-glib-main.c
> +++ b/libvirt-glib/libvirt-glib-main.c
> @@ -63,8 +63,12 @@ gboolean gvir_init_check(int *argc G_GNUC_UNUSED,
>                           GError **err G_GNUC_UNUSED)
>  {
>      virSetErrorFunc(NULL, gvir_error_func);
> +
> +    /* Threading is always enabled from 2.31.0 onwards */
> +#if !GLIB_CHECK_VERSION(2, 31, 0)
>      if (!g_thread_supported())
>          g_thread_init(NULL);
> +#endif
>  
>      virInitialize();
>  
> diff --git a/libvirt-gobject/libvirt-gobject-compat.h b/libvirt-gobject/libvirt-gobject-compat.h
> index 0c37537..839dfe1 100644
> --- a/libvirt-gobject/libvirt-gobject-compat.h
> +++ b/libvirt-gobject/libvirt-gobject-compat.h
> @@ -26,6 +26,11 @@
>  #include <glib-object.h>
>  #include <gio/gio.h>
>  
> +#if GLIB_CHECK_VERSION(2, 31, 0)
> +#define g_mutex_new() g_new0(GMutex, 1)
> +#define g_mutex_free(m) g_free(m)
> +#endif
> +
>  #if !GLIB_CHECK_VERSION(2,26,0)
>  #define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {})
>  #define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
> diff --git a/libvirt-gobject/libvirt-gobject-manager.c b/libvirt-gobject/libvirt-gobject-manager.c
> index aef519f..da5d31d 100644
> --- a/libvirt-gobject/libvirt-gobject-manager.c
> +++ b/libvirt-gobject/libvirt-gobject-manager.c
> @@ -28,6 +28,7 @@
>  
>  #include "libvirt-glib/libvirt-glib.h"
>  #include "libvirt-gobject/libvirt-gobject.h"
> +#include "libvirt-gobject/libvirt-gobject-compat.h"
>  
>  #define GVIR_MANAGER_GET_PRIVATE(obj)                         \
>          (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_MANAGER, GVirManagerPrivate))
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpmz10yKIIjB.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]