libpurple/glibcompat.h

Fri, 19 Aug 2016 23:03:37 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 19 Aug 2016 23:03:37 -0500
changeset 37901
41e45e18f3b2
parent 37611
8c825b048d24
child 38045
6e8b223df524
permissions
-rw-r--r--

Monster merge everything

33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
1 /* pidgin
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
2 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
5 * source distribution.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
6 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
11 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
16 *
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
20 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
21
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
22 #ifndef _GLIBCOMPAT_H_
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35460
diff changeset
23 #define _GLIBCOMPAT_H_
35460
96946e21fce5 Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents: 35440
diff changeset
24 /*
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
25 * SECTION:glibcompat
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
26 * @section_id: libpurple-glibcompat
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
27 * @short_description: <filename>glibcompat.h</filename>
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
28 * @title: GLib version-dependent definitions
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
29 *
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
30 * This file is internal to libpurple. Do not use!
33368
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
31 * Also, any public API should not depend on this file.
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
32 */
6aa16fdab83f Fix compilation of older distros. Fixes #15310
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
33
35306
abc36dad1363 Include glib.h before messing with any defines
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35299
diff changeset
34 #include <glib.h>
abc36dad1363 Include glib.h before messing with any defines
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35299
diff changeset
35
35706
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
36 #if !GLIB_CHECK_VERSION(2, 36, 0)
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
37
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
38 #include <errno.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
39 #include <fcntl.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
40 #ifndef _WIN32
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
41 #include <unistd.h>
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
42 #endif
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
43
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
44 static inline gboolean g_close(gint fd, GError **error)
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
45 {
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
46 int res;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
47 int errsv;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
48
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
49 res = close(fd);
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
50
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
51 if (G_LIKELY(res == 0))
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
52 return TRUE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
53 if (G_UNLIKELY(errno == EINTR))
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
54 return TRUE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
55
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
56 errsv = errno;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
57 g_set_error_literal(error, G_FILE_ERROR,
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
58 g_file_error_from_errno(errsv), g_strerror(errsv));
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
59 errno = errsv;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
60
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
61 return FALSE;
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
62 }
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
63
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
64 #endif /* < 2.36.0 */
6a0bbe6adc4a PidginSmileyTheme: some fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
65
35804
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
66
35872
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
67 /* glib's definition of g_stat+GStatBuf seems to be broken on mingw64-w32 (and
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
68 * possibly other 32-bit windows), so instead of relying on it,
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
69 * we'll define our own.
35867
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
70 */
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
71 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
72 # include <glib/gstdio.h>
35872
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
73 typedef struct _stat GStatBufW32;
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
74 static inline int
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
75 purple_g_stat(const gchar *filename, GStatBufW32 *buf)
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
76 {
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
77 return g_stat(filename, (GStatBuf*)buf);
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
78 }
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
79 # define GStatBuf GStatBufW32
4cd48601e1d1 cross-win32: better fix for g_stat bug
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35867
diff changeset
80 # define g_stat purple_g_stat
35867
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
81 #endif
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
82
b6f09494adda cross-win32: hide glib bug of mismatched g_stat and GStatBuf for win32 (not win64)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35804
diff changeset
83
35804
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
84 #ifdef __clang__
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
85
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
86 #undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
87 #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
88 _Pragma ("clang diagnostic push") \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
89 _Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"")
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
90
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
91 #undef G_GNUC_END_IGNORE_DEPRECATIONS
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
92 #define G_GNUC_END_IGNORE_DEPRECATIONS \
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
93 _Pragma ("clang diagnostic pop")
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
94
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
95 #endif /* __clang__ */
e97d93132751 Image store: most of the implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35706
diff changeset
96
37611
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
97 /******************************************************************************
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
98 * g_assert_* macros
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
99 *****************************************************************************/
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
100 #if !GLIB_CHECK_VERSION(2, 38, 0)
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
101 #define g_assert_true(expr) G_STMT_START { \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
102 if G_LIKELY (expr) ; else \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
103 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
104 "'" #expr "' should be TRUE"); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
105 } G_STMT_END
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
106 #define g_assert_false(expr) G_STMT_START { \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
107 if G_LIKELY (!(expr)) ; else \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
108 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
109 "'" #expr "' should be FALSE"); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
110 } G_STMT_END
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
111 #define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
112 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
113 "'" #expr "' should be NULL"); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
114 } G_STMT_END
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
115 #endif
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
116
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
117 #if !GLIB_CHECK_VERSION(2, 40, 0)
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
118 #define g_assert_nonnull(expr) G_STMT_START { \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
119 if G_LIKELY ((expr) != NULL) ; else \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
120 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
121 "'" #expr "' should not be NULL"); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
122 } G_STMT_END
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
123 #endif
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
124
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
125 #if !GLIB_CHECK_VERSION(2, 46, 0)
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
126 #define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
127 gconstpointer __m1 = m1, __m2 = m2; \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
128 int __l1 = l1, __l2 = l2; \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
129 if (__l1 != __l2) \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
130 g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
131 #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", __l1, "==", __l2, 'i'); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
132 else if (memcmp (__m1, __m2, __l1) != 0) \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
133 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
134 "assertion failed (" #m1 " == " #m2 ")"); \
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
135 } G_STMT_END
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
136 #endif
8c825b048d24 Update glibcompat.h for the g_assert_* macros that have been added after 2.34
Gary Kramlich <grim@reaperworld.com>
parents: 37463
diff changeset
137
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35306
diff changeset
138 #endif /* _GLIBCOMPAT_H_ */

mercurial