libnm-util: ensure address/route types are boxed on glib < 2.26
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION(2,31,0)
|
#if !GLIB_CHECK_VERSION(2,31,0)
|
||||||
#define g_value_set_schar g_value_set_char
|
#define g_value_set_schar g_value_set_char
|
||||||
@@ -54,4 +55,23 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef G_DEFINE_BOXED_TYPE
|
||||||
|
#define G_DEFINE_BOXED_TYPE(t,p,d,f) \
|
||||||
|
GType \
|
||||||
|
p##_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(#t), \
|
||||||
|
(GBoxedCopyFunc) d, \
|
||||||
|
(GBoxedFreeFunc) f); \
|
||||||
|
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
|
||||||
|
} \
|
||||||
|
return g_define_type_id__volatile; \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* NM_GLIB_COMPAT_H */
|
#endif /* NM_GLIB_COMPAT_H */
|
||||||
|
@@ -30,6 +30,9 @@
|
|||||||
#include "nm-param-spec-specialized.h"
|
#include "nm-param-spec-specialized.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-dbus-glib-types.h"
|
#include "nm-dbus-glib-types.h"
|
||||||
|
#include "nm-glib-compat.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:nm-setting-ip4-config
|
* SECTION:nm-setting-ip4-config
|
||||||
@@ -57,10 +60,8 @@ nm_setting_ip4_config_error_quark (void)
|
|||||||
return quark;
|
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 (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)
|
G_DEFINE_BOXED_TYPE (NMIP4Route, nm_ip4_route, nm_ip4_route_dup, nm_ip4_route_unref)
|
||||||
#endif
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING)
|
G_DEFINE_TYPE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING)
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "nm-param-spec-specialized.h"
|
#include "nm-param-spec-specialized.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-dbus-glib-types.h"
|
#include "nm-dbus-glib-types.h"
|
||||||
|
#include "nm-glib-compat.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:nm-setting-ip6-config
|
* SECTION:nm-setting-ip6-config
|
||||||
@@ -56,10 +57,8 @@ nm_setting_ip6_config_error_quark (void)
|
|||||||
return quark;
|
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 (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)
|
G_DEFINE_BOXED_TYPE (NMIP6Route, nm_ip6_route, nm_ip6_route_dup, nm_ip6_route_unref)
|
||||||
#endif
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING)
|
G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user