Re: [PATCH] Fix nm_ip(4|6)_(address|route)_get_type on glib <2.26
- From: Dan Williams <dcbw redhat com>
- To: Robert Shade <robert shade gmail com>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] Fix nm_ip(4|6)_(address|route)_get_type on glib <2.26
- Date: Mon, 02 Jul 2012 13:21:17 -0500
On Sat, 2012-06-30 at 23:17 -0400, Robert Shade wrote:
> These types aren't getting defined on glib<2.26
Thanks; I pushed a slightly different fix where instead of opencoding
this, I put a #define for G_DEFINE_BOXED TYPE into
include/nm-glib-compat.h where we've got other compat stuff.
Thanks!
Dan
> ---
> libnm-util/nm-setting-ip4-config.c | 41 ++++++++++++++++++++++++++++++++---
> libnm-util/nm-setting-ip6-config.c | 41 ++++++++++++++++++++++++++++++++---
> 2 files changed, 74 insertions(+), 8 deletions(-)
>
> diff --git a/libnm-util/nm-setting-ip4-config.c
> b/libnm-util/nm-setting-ip4-config.c
> index 54cf036..6cb6ec6 100644
> --- a/libnm-util/nm-setting-ip4-config.c
> +++ b/libnm-util/nm-setting-ip4-config.c
> @@ -57,10 +57,43 @@ nm_setting_ip4_config_error_quark (void)
> return quark;
> }
>
> -#if GLIB_CHECK_VERSION(2,26,0)
> -G_DEFINE_BOXED_TYPE (NMIP4Address, nm_ip4_address,
> nm_ip4_address_dup, nm_ip4_address_unref)
> -G_DEFINE_BOXED_TYPE (NMIP4Route, nm_ip4_route, nm_ip4_route_dup,
> nm_ip4_route_unref)
> -#endif
> +GType
> +nm_ip4_address_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("NMIP4Address"),
> + (GBoxedCopyFunc)nm_ip4_address_dup,
> + (GBoxedFreeFunc)nm_ip4_address_unref);
> +
> + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
> + }
> +
> + return g_define_type_id__volatile;
> +}
> +
> +GType
> +nm_ip4_route_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("NMIP4Route"),
> + (GBoxedCopyFunc)nm_ip4_route_dup,
> + (GBoxedFreeFunc)nm_ip4_route_unref);
> +
> + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
> + }
> +
> + return g_define_type_id__volatile;
> +}
>
> G_DEFINE_TYPE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING)
>
> diff --git a/libnm-util/nm-setting-ip6-config.c
> b/libnm-util/nm-setting-ip6-config.c
> index 67c101d..427622f 100644
> --- a/libnm-util/nm-setting-ip6-config.c
> +++ b/libnm-util/nm-setting-ip6-config.c
> @@ -56,10 +56,43 @@ nm_setting_ip6_config_error_quark (void)
> return quark;
> }
>
> -#if GLIB_CHECK_VERSION(2,26,0)
> -G_DEFINE_BOXED_TYPE (NMIP6Address, nm_ip6_address,
> nm_ip6_address_dup, nm_ip6_address_unref)
> -G_DEFINE_BOXED_TYPE (NMIP6Route, nm_ip6_route, nm_ip6_route_dup,
> nm_ip6_route_unref)
> -#endif
> +GType
> +nm_ip6_address_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("NMIP6Address"),
> + (GBoxedCopyFunc)nm_ip6_address_dup,
> + (GBoxedFreeFunc)nm_ip6_address_unref);
> +
> + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
> + }
> +
> + return g_define_type_id__volatile;
> +}
> +
> +GType
> +nm_ip6_route_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("NMIP6Route"),
> + (GBoxedCopyFunc)nm_ip6_route_dup,
> + (GBoxedFreeFunc)nm_ip6_route_unref);
> +
> + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
> + }
> +
> + return g_define_type_id__volatile;
> +}
>
> G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING)
>
> --
> 1.7.1
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]