[virt-tools-list] [PATCH v3 5/5] Drop old compatibility code

Fabiano Fidêncio ffidenci at redhat.com
Mon Feb 15 13:57:47 UTC 2016


On Fri, 2016-02-12 at 09:35 -0200, Eduardo Lima (Etrunko) wrote:
> With glib requirements now being 2.38, these functions do not make
> sense anymore
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> ---
>  src/virt-glib-compat.c | 15 ---------------
>  src/virt-glib-compat.h | 27 ---------------------------
>  2 files changed, 42 deletions(-)
> 
> diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
> index c15ff28..04d5c8c 100644
> --- a/src/virt-glib-compat.c
> +++ b/src/virt-glib-compat.c
> @@ -17,18 +17,3 @@
>  
>  #include "virt-glib-compat.h"
>  
> -#if !GLIB_CHECK_VERSION(2,32,0)
> -GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
> -{
> -  GByteArray *array;
> -
> -  array = g_byte_array_new ();
> -  g_assert (array->data == NULL);
> -  g_assert (array->len == 0);
> -
> -  array->data = data;
> -  array->len = len;
> -
> -  return array;
> -}
> -#endif
> diff --git a/src/virt-glib-compat.h b/src/virt-glib-compat.h
> index 1242289..23345a0 100644
> --- a/src/virt-glib-compat.h
> +++ b/src/virt-glib-compat.h
> @@ -51,33 +51,6 @@ G_BEGIN_DECLS
>    } G_STMT_END
>  #endif
>  
> -#if !GLIB_CHECK_VERSION(2,28,0)
> -#define g_clear_object(object_ptr) \
> -  G_STMT_START
> {                                                             \
> -    /* Only one access, please
> */                                            \
> -    gpointer *_p = (gpointer)
> (object_ptr);                                  \
> -    gpointer
> _o;                                                             \
> -                                                                    
>          \
> -    do                                                              
>          \
> -      _o = g_atomic_pointer_get
> (_p);                                        \
> -    while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_p,
> _o, NULL));\
> -                                                                    
>          \
> -    if
> (_o)                                                                 
>  \
> -      g_object_unref
> (_o);                                                   \
> -  } G_STMT_END
> -#endif
> -
> -#if !GLIB_CHECK_VERSION(2,32,0)
> -GByteArray *g_byte_array_new_take (guint8 *data, gsize len);
> -
> -#define G_SOURCE_CONTINUE   TRUE
> -#define G_SOURCE_REMOVE     FALSE
> -#endif
> -
> -#if GLIB_CHECK_VERSION(2,31,0)
> -#define g_mutex_new() g_new0(GMutex, 1)
> -#endif
> -
>  G_END_DECLS
>  
>  #endif // _VIRT_GLIB_COMPAT_H

NACK from me.
There is no reason for keeping an empty virt-glib-compat.c file.
virt-glib-compat.h also could be removed entirely as g_clear_pointer()
was introduced in 2.34. So, please, remove both files from the tree.

Reviewed-by: Fabiano Fidêncio <fidencio at redhat.com>




More information about the virt-tools-list mailing list