/pidgin/main: 8c825b048d24: Update glibcompat.h for the g_assert...
Gary Kramlich
grim at reaperworld.com
Wed Mar 30 19:25:28 EDT 2016
Changeset: 8c825b048d24334c5116b9d0819cb4c804d8d7c2
Author: Gary Kramlich <grim at reaperworld.com>
Date: 2016-03-20 23:28 -0500
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/8c825b048d24
Description:
Update glibcompat.h for the g_assert_* macros that have been added after 2.34
diffstat:
libpurple/glibcompat.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diffs (49 lines):
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -94,4 +94,45 @@ purple_g_stat(const gchar *filename, GSt
#endif /* __clang__ */
+/******************************************************************************
+ * g_assert_* macros
+ *****************************************************************************/
+#if !GLIB_CHECK_VERSION(2, 38, 0)
+#define g_assert_true(expr) G_STMT_START { \
+ if G_LIKELY (expr) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be TRUE"); \
+ } G_STMT_END
+#define g_assert_false(expr) G_STMT_START { \
+ if G_LIKELY (!(expr)) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be FALSE"); \
+ } G_STMT_END
+#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be NULL"); \
+ } G_STMT_END
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 40, 0)
+#define g_assert_nonnull(expr) G_STMT_START { \
+ if G_LIKELY ((expr) != NULL) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should not be NULL"); \
+ } G_STMT_END
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 46, 0)
+#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
+
#endif /* _GLIBCOMPAT_H_ */
More information about the Commits
mailing list