diff options
author | Thomas Haller <thaller@redhat.com> | 2015-11-25 10:28:33 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-11-25 10:58:18 +0100 |
commit | 5196e53071d8bce401366572392886bea51397f3 (patch) | |
tree | 2a42fb7914797e77f5f33d445c4f1ee6c926cccb | |
parent | 061b7bbde855146019aec189f76ddceec28bcb5b (diff) | |
download | NetworkManager-5196e53071d8bce401366572392886bea51397f3.tar.gz |
nm-glib: add nm_glib_check_version() util
(cherry picked from commit 4c4b67e515596b85e1d3d42ace0833feee8eb731)
-rw-r--r-- | include/nm-glib-compat.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index dc39d2b934..691f9935c9 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -111,6 +111,17 @@ __g_type_ensure (GType type) #define g_test_initialized() (g_test_config_vars->test_initialized) #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) \ + ( GLIB_CHECK_VERSION ((major), (minor), (micro)) \ + || ( ( glib_major_version > (major)) \ + || ( glib_major_version == (major) \ + && glib_minor_version > (minor)) \ + || ( glib_major_version == (major) \ + && glib_minor_version == (minor) \ + && glib_micro_version >= (micro)))) + /* g_test_skip() is only available since glib 2.38. Add a compatibility wrapper. */ inline static void __nmtst_g_test_skip (const gchar *msg) |