Re: [libvirt-glib v2 1/3] gobject: Drop redundant glib compatibility code

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

 



ACK.

On Fri, Nov 20, 2015 at 09:06:28PM +0000, Zeeshan Ali (Khattak) wrote:
> We already require and use glib >= 2.36 so there is no reason to keep
> around code to ensure compatibility with glib older than that.
> ---
>  libvirt-gobject/libvirt-gobject-compat.c | 87 --------------------------------
>  libvirt-gobject/libvirt-gobject-compat.h | 73 ---------------------------
>  2 files changed, 160 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-compat.c b/libvirt-gobject/libvirt-gobject-compat.c
> index 14b5eb3..e91b018 100644
> --- a/libvirt-gobject/libvirt-gobject-compat.c
> +++ b/libvirt-gobject/libvirt-gobject-compat.c
> @@ -17,93 +17,6 @@
>  
>  #include "libvirt-gobject-compat.h"
>  
> -#if !GLIB_CHECK_VERSION(2,28,0)
> -/**
> - * g_simple_async_result_take_error: (skip)
> - * @simple: a #GSimpleAsyncResult
> - * @error: a #GError
> - *
> - * Sets the result from @error, and takes over the caller's ownership
> - * of @error, so the caller does not need to free it any more.
> - *
> - * Since: 2.28
> - **/
> -G_GNUC_INTERNAL void
> -g_simple_async_result_take_error (GSimpleAsyncResult *simple,
> -                                  GError             *error)
> -{
> -    /* this code is different from upstream */
> -    /* we can't avoid extra copy/free, since the simple struct is
> -       opaque */
> -    g_simple_async_result_set_from_error (simple, error);
> -    g_error_free (error);
> -}
> -
> -/**
> - * g_simple_async_result_new_take_error: (skip)
> - * @source_object: (allow-none): a #GObject, or %NULL
> - * @callback: (scope async): a #GAsyncReadyCallback
> - * @user_data: (closure): user data passed to @callback
> - * @error: a #GError
> - *
> - * Creates a #GSimpleAsyncResult from an error condition, and takes over the
> - * caller's ownership of @error, so the caller does not need to free it anymore.
> - *
> - * Returns: a #GSimpleAsyncResult
> - *
> - * Since: 2.28
> - **/
> -GSimpleAsyncResult *
> -g_simple_async_result_new_take_error(GObject *source_object,
> -                                     GAsyncReadyCallback callback,
> -                                     gpointer user_data,
> -                                     GError *error)
> -{
> -    GSimpleAsyncResult *simple;
> -
> -    g_return_val_if_fail(!source_object || G_IS_OBJECT(source_object), NULL);
> -
> -    simple = g_simple_async_result_new(source_object,
> -                                       callback,
> -                                       user_data, NULL);
> -    g_simple_async_result_take_error(simple, error);
> -
> -    return simple;
> -}
> -
> -/**
> - * g_simple_async_report_take_gerror_in_idle: (skip)
> - * @object: (allow-none): a #GObject, or %NULL
> - * @callback: a #GAsyncReadyCallback.
> - * @user_data: user data passed to @callback.
> - * @error: the #GError to report
> - *
> - * Reports an error in an idle function. Similar to
> - * g_simple_async_report_gerror_in_idle(), but takes over the caller's
> - * ownership of @error, so the caller does not have to free it any more.
> - *
> - * Since: 2.28
> - **/
> -void
> -g_simple_async_report_take_gerror_in_idle(GObject *object,
> -                                          GAsyncReadyCallback callback,
> -                                          gpointer user_data,
> -                                          GError *error)
> -{
> -    GSimpleAsyncResult *simple;
> -
> -    g_return_if_fail(!object || G_IS_OBJECT(object));
> -    g_return_if_fail(error != NULL);
> -
> -    simple = g_simple_async_result_new_take_error(object,
> -                                                  callback,
> -                                                  user_data,
> -                                                  error);
> -    g_simple_async_result_complete_in_idle(simple);
> -    g_object_unref(simple);
> -}
> -#endif
> -
>  GMutex *gvir_mutex_new(void)
>  {
>      GMutex *mutex;
> diff --git a/libvirt-gobject/libvirt-gobject-compat.h b/libvirt-gobject/libvirt-gobject-compat.h
> index 2e87966..27fa305 100644
> --- a/libvirt-gobject/libvirt-gobject-compat.h
> +++ b/libvirt-gobject/libvirt-gobject-compat.h
> @@ -35,77 +35,4 @@ GMutex *gvir_mutex_new(void);
>  
>  #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()
> -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
> -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
> -GType \
> -type_name##_get_type (void) \
> -{ \
> -  static volatile gsize g_define_type_id__volatile = 0; \
> -  if (g_once_init_enter (&g_define_type_id__volatile))  \
> -    { \
> -      GType (* _g_register_boxed) \
> -        (const gchar *, \
> -         union \
> -           { \
> -             TypeName * (*do_copy_type) (TypeName *); \
> -             TypeName * (*do_const_copy_type) (const TypeName *); \
> -             GBoxedCopyFunc do_copy_boxed; \
> -           } __attribute__((__transparent_union__)), \
> -         union \
> -           { \
> -             void (* do_free_type) (TypeName *); \
> -             GBoxedFreeFunc do_free_boxed; \
> -           } __attribute__((__transparent_union__)) \
> -        ) = g_boxed_type_register_static; \
> -      GType g_define_type_id = \
> -        _g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \
> -      { /* custom code follows */
> -#else
> -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
> -GType \
> -type_name##_get_type (void) \
> -{ \
> -  static volatile gsize g_define_type_id__volatile = 0; \
> -  if (g_once_init_enter (&g_define_type_id__volatile))  \
> -    { \
> -      GType g_define_type_id = \
> -        g_boxed_type_register_static (g_intern_static_string (#TypeName), \
> -                                      (GBoxedCopyFunc) copy_func, \
> -                                      (GBoxedFreeFunc) free_func); \
> -      { /* custom code follows */
> -#endif /* __GNUC__ */
> -#endif /* glib 2.26 */
> -
> -#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
> -
> -void
> -g_simple_async_result_take_error(GSimpleAsyncResult *simple,
> -                                 GError             *error);
> -GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject                 *source_object,
> -                                                          GAsyncReadyCallback      callback,
> -                                                          gpointer                 user_data,
> -                                                          GError                  *error);
> -void g_simple_async_report_take_gerror_in_idle (GObject            *object,
> -                                                GAsyncReadyCallback callback,
> -                                                gpointer            user_data,
> -                                                GError             *error);
> -#endif /* glib 2.28 */
> -
> -
>  #endif /* __LIBVIRT_GOBJECT_COMPAT_H__ */
> -- 
> 2.5.0
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]