diff options
Diffstat (limited to 'shared/nm-glib.h')
| -rw-r--r-- | shared/nm-glib.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/nm-glib.h b/shared/nm-glib.h index c75e91ba..c92d6f0f 100644 --- a/shared/nm-glib.h +++ b/shared/nm-glib.h @@ -116,6 +116,20 @@ __g_type_ensure (GType type) #define g_test_initialized() (g_test_config_vars->test_initialized) #endif +/* g_assert_cmpmem() is only available since glib 2.46. */ +#if !GLIB_CHECK_VERSION (2, 45, 7) +#define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\ + gconstpointer __m1 = m1, __m2 = m2; \ + int __l1 = l1, __l2 = l2; \ + if (__l1 != __l2) \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", __l1, "==", __l2, 'i'); \ + else if (memcmp (__m1, __m2, __l1) != 0) \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #m1 " == " #m2 ")"); \ + } G_STMT_END +#endif + /* Rumtime check for glib version. First do a compile time check which * (if satisfied) shortcuts the runtime check. */ #define nm_glib_check_version(major, minor, micro) \ @@ -353,4 +367,11 @@ _nm_g_hash_table_get_keys_as_array (GHashTable *hash_table, }) #endif +#ifndef g_info +/* g_info was only added with 2.39.2 */ +#define g_info(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_INFO, \ + __VA_ARGS__) +#endif + #endif /* __NM_GLIB_H__ */ |