diff options
author | Dan Williams <dcbw@redhat.com> | 2012-07-02 13:20:21 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-07-02 13:20:21 -0500 |
commit | 18b0ba499cd2b4485c40f39c654a33a8c1059b56 (patch) | |
tree | 1b988997cdd39f344d6e0fa4b4b7652279bb2b2d /include | |
parent | 0677bf9c07cec081b5be980236296ebdbdfef9ab (diff) |
libnm-util: ensure address/route types are boxed on glib < 2.26
Diffstat (limited to 'include')
-rw-r--r-- | include/nm-glib-compat.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index 3b772f4f..f9c1ae49 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -25,6 +25,7 @@ #include <glib.h> +#include <glib-object.h> #if !GLIB_CHECK_VERSION(2,31,0) #define g_value_set_schar g_value_set_char @@ -54,4 +55,23 @@ #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 */ |