/src/glib/glib/glib-private.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* glib-private.h - GLib-internal private API, shared between glib, gobject, gio |
2 | | * Copyright (C) 2011 Red Hat, Inc. |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | * |
6 | | * This library is free software; you can redistribute it and/or |
7 | | * modify it under the terms of the GNU Lesser General Public |
8 | | * License as published by the Free Software Foundation; either |
9 | | * version 2.1 of the License, or (at your option) any later version. |
10 | | * |
11 | | * This library is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | | * Lesser General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU Lesser General Public License |
17 | | * along with this library; if not, see <http://www.gnu.org/licenses/>. |
18 | | */ |
19 | | |
20 | | #ifndef __GLIB_PRIVATE_H__ |
21 | | #define __GLIB_PRIVATE_H__ |
22 | | |
23 | | #include <glib.h> |
24 | | #include "gwakeup.h" |
25 | | #include "gstdioprivate.h" |
26 | | #include "gdatasetprivate.h" |
27 | | |
28 | | /* |
29 | | * G_SIGNEDNESS_OF: |
30 | | * @T: a numeric type such as `unsigned int` |
31 | | * |
32 | | * An integer constant expression indicating whether @T is a signed type. |
33 | | * |
34 | | * Returns: 1 if @T is signed, 0 if it is unsigned |
35 | | */ |
36 | | #define G_SIGNEDNESS_OF(T) (((T) -1) <= 0) |
37 | | |
38 | | /* gcc defines __SANITIZE_ADDRESS__, clang sets the address_sanitizer |
39 | | * feature flag. |
40 | | * |
41 | | * MSVC defines __SANITIZE_ADDRESS__ as well when AddressSanitizer |
42 | | * is enabled but __lsan_ignore_object() equivalent method is not supported |
43 | | * See also |
44 | | * https://docs.microsoft.com/en-us/cpp/sanitizers/asan-building?view=msvc-160 |
45 | | */ |
46 | | #if !defined(_MSC_VER) && (defined(__SANITIZE_ADDRESS__) || g_macro__has_feature(address_sanitizer)) |
47 | | |
48 | | /* |
49 | | * %_GLIB_ADDRESS_SANITIZER: |
50 | | * |
51 | | * Private macro defined if the AddressSanitizer is in use by GLib itself. |
52 | | */ |
53 | | #define _GLIB_ADDRESS_SANITIZER |
54 | | |
55 | | #include <sanitizer/lsan_interface.h> |
56 | | |
57 | | /* If GLib itself is not compiled with ASAN sanitizer we may still want to |
58 | | * control it in case it's linked by the loading application, so we need to |
59 | | * do this check dynamically. |
60 | | * However MinGW/Cygwin doesn't support weak attribute properly (even if it advertises |
61 | | * it), so we ignore it in such case since it's not convenient to go through |
62 | | * dlsym(). |
63 | | * Under MSVC we could use alternatename, but it doesn't seem to be as reliable |
64 | | * as we'd like: https://stackoverflow.com/a/11529277/210151 and |
65 | | * https://devblogs.microsoft.com/oldnewthing/20200731-00/?p=104024 |
66 | | */ |
67 | | #elif defined (G_OS_UNIX) && !defined (__APPLE__) && !defined(__CYGWIN__) && !defined(_AIX) && \ |
68 | | g_macro__has_attribute (weak) |
69 | | |
70 | | #define HAS_DYNAMIC_ASAN_LOADING |
71 | | |
72 | | void __lsan_enable (void) __attribute__ ((weak)); |
73 | | void __lsan_disable (void) __attribute__ ((weak)); |
74 | | void __lsan_ignore_object (const void *p) __attribute__ ((weak)); |
75 | | |
76 | | #endif |
77 | | |
78 | | /** |
79 | | * G_CONTAINER_OF: |
80 | | * @ptr: a pointer to a member @field of type @type. |
81 | | * @type: the type of the container in which @field is embedded. |
82 | | * @field: the name of the field in @type. |
83 | | * |
84 | | * Casts away constness of @ptr. |
85 | | * |
86 | | * Returns: a pointer to the container, so that "&(@container)->field == (@ptr)" holds. |
87 | | */ |
88 | 0 | #define G_CONTAINER_OF(ptr, type, field) ((type *) G_STRUCT_MEMBER_P (ptr, -G_STRUCT_OFFSET (type, field))) |
89 | | |
90 | | /* |
91 | | * g_leak_sanitizer_is_supported: |
92 | | * |
93 | | * Checks at runtime if LeakSanitizer is currently supported by the running |
94 | | * binary. This may imply that GLib itself is not compiled with sanitizer |
95 | | * but that the loading program is. |
96 | | */ |
97 | | static inline gboolean |
98 | | g_leak_sanitizer_is_supported (void) |
99 | 0 | { |
100 | | #if defined (_GLIB_ADDRESS_SANITIZER) |
101 | | return TRUE; |
102 | | #elif defined (HAS_DYNAMIC_ASAN_LOADING) |
103 | 0 | return G_UNLIKELY (__lsan_enable != NULL && __lsan_ignore_object != NULL); |
104 | | #else |
105 | | return FALSE; |
106 | | #endif |
107 | 0 | } Unexecuted instantiation: gmessages.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gtestutils.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gthread.c:g_leak_sanitizer_is_supported Unexecuted instantiation: guri.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gutils.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gvarianttypeinfo.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gcharset.c:g_leak_sanitizer_is_supported Unexecuted instantiation: genviron.c:g_leak_sanitizer_is_supported Unexecuted instantiation: ggettext.c:g_leak_sanitizer_is_supported Unexecuted instantiation: ghash.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glib-init.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gmain.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gquark.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glib-unix.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gthreadedresolver.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gcancellable.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gtask.c:g_leak_sanitizer_is_supported Unexecuted instantiation: giomodule.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gproxyaddressenumerator.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gvfs.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gdesktopappinfo.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gapplication.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gdbusprivate.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gportalsupport.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfilemonitor.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gcontextspecificgroup.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gresource.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gunixfdlist.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gcontenttype-fdo.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gsettingsschema.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gdbusaddress.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gdbusauthmechanismsha1.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfile.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfileenumerator.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfileinfo.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfileinputstream.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfileoutputstream.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glocalfileiostream.c:g_leak_sanitizer_is_supported Unexecuted instantiation: thumbnail-verify.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gsubprocess.c:g_leak_sanitizer_is_supported Unexecuted instantiation: inotify-missing.c:g_leak_sanitizer_is_supported Unexecuted instantiation: inotify-kernel.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gobject.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gtype.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gdir.c:g_leak_sanitizer_is_supported Unexecuted instantiation: glib-private.c:g_leak_sanitizer_is_supported Unexecuted instantiation: gthreadpool.c:g_leak_sanitizer_is_supported |
108 | | |
109 | | /* |
110 | | * g_ignore_leak: |
111 | | * @p: any pointer |
112 | | * |
113 | | * Tell AddressSanitizer and similar tools that if the object pointed to |
114 | | * by @p is leaked, it is not a problem. Use this to suppress memory leak |
115 | | * reports when a potentially unreachable pointer is deliberately not |
116 | | * going to be deallocated. |
117 | | */ |
118 | | static inline void |
119 | | g_ignore_leak (gconstpointer p) |
120 | 2 | { |
121 | | #if defined (_GLIB_ADDRESS_SANITIZER) |
122 | | if (p != NULL) |
123 | | __lsan_ignore_object (p); |
124 | | #elif defined (HAS_DYNAMIC_ASAN_LOADING) |
125 | 2 | if (G_LIKELY (p != NULL) && G_UNLIKELY (__lsan_ignore_object != NULL)) |
126 | 0 | __lsan_ignore_object (p); |
127 | 2 | #endif |
128 | 2 | } Unexecuted instantiation: gmessages.c:g_ignore_leak Unexecuted instantiation: gtestutils.c:g_ignore_leak Unexecuted instantiation: gthread.c:g_ignore_leak Unexecuted instantiation: guri.c:g_ignore_leak Unexecuted instantiation: gutils.c:g_ignore_leak gvarianttypeinfo.c:g_ignore_leak Line | Count | Source | 120 | 2 | { | 121 | | #if defined (_GLIB_ADDRESS_SANITIZER) | 122 | | if (p != NULL) | 123 | | __lsan_ignore_object (p); | 124 | | #elif defined (HAS_DYNAMIC_ASAN_LOADING) | 125 | 2 | if (G_LIKELY (p != NULL) && G_UNLIKELY (__lsan_ignore_object != NULL)) | 126 | 0 | __lsan_ignore_object (p); | 127 | 2 | #endif | 128 | 2 | } |
Unexecuted instantiation: gcharset.c:g_ignore_leak Unexecuted instantiation: genviron.c:g_ignore_leak Unexecuted instantiation: ggettext.c:g_ignore_leak Unexecuted instantiation: ghash.c:g_ignore_leak Unexecuted instantiation: glib-init.c:g_ignore_leak Unexecuted instantiation: gmain.c:g_ignore_leak Unexecuted instantiation: gquark.c:g_ignore_leak Unexecuted instantiation: glib-unix.c:g_ignore_leak Unexecuted instantiation: gthreadedresolver.c:g_ignore_leak Unexecuted instantiation: gcancellable.c:g_ignore_leak Unexecuted instantiation: gtask.c:g_ignore_leak Unexecuted instantiation: giomodule.c:g_ignore_leak Unexecuted instantiation: gproxyaddressenumerator.c:g_ignore_leak Unexecuted instantiation: gvfs.c:g_ignore_leak Unexecuted instantiation: gdesktopappinfo.c:g_ignore_leak Unexecuted instantiation: gapplication.c:g_ignore_leak Unexecuted instantiation: gdbusprivate.c:g_ignore_leak Unexecuted instantiation: gportalsupport.c:g_ignore_leak Unexecuted instantiation: glocalfilemonitor.c:g_ignore_leak Unexecuted instantiation: gcontextspecificgroup.c:g_ignore_leak Unexecuted instantiation: gresource.c:g_ignore_leak Unexecuted instantiation: gunixfdlist.c:g_ignore_leak Unexecuted instantiation: gcontenttype-fdo.c:g_ignore_leak Unexecuted instantiation: gsettingsschema.c:g_ignore_leak Unexecuted instantiation: gdbusaddress.c:g_ignore_leak Unexecuted instantiation: gdbusauthmechanismsha1.c:g_ignore_leak Unexecuted instantiation: glocalfile.c:g_ignore_leak Unexecuted instantiation: glocalfileenumerator.c:g_ignore_leak Unexecuted instantiation: glocalfileinfo.c:g_ignore_leak Unexecuted instantiation: glocalfileinputstream.c:g_ignore_leak Unexecuted instantiation: glocalfileoutputstream.c:g_ignore_leak Unexecuted instantiation: glocalfileiostream.c:g_ignore_leak Unexecuted instantiation: thumbnail-verify.c:g_ignore_leak Unexecuted instantiation: gsubprocess.c:g_ignore_leak Unexecuted instantiation: inotify-missing.c:g_ignore_leak Unexecuted instantiation: inotify-kernel.c:g_ignore_leak Unexecuted instantiation: gobject.c:g_ignore_leak Unexecuted instantiation: gtype.c:g_ignore_leak Unexecuted instantiation: gdir.c:g_ignore_leak Unexecuted instantiation: glib-private.c:g_ignore_leak Unexecuted instantiation: gthreadpool.c:g_ignore_leak |
129 | | |
130 | | /* |
131 | | * g_ignore_strv_leak: |
132 | | * @strv: (nullable) (array zero-terminated=1): an array of strings |
133 | | * |
134 | | * The same as g_ignore_leak(), but for the memory pointed to by @strv, |
135 | | * and for each element of @strv. |
136 | | */ |
137 | | static inline void |
138 | | g_ignore_strv_leak (GStrv strv) |
139 | 0 | { |
140 | 0 | gchar **item; |
141 | |
|
142 | 0 | if (!g_leak_sanitizer_is_supported ()) |
143 | 0 | return; |
144 | | |
145 | 0 | if (strv) |
146 | 0 | { |
147 | 0 | g_ignore_leak (strv); |
148 | |
|
149 | 0 | for (item = strv; *item != NULL; item++) |
150 | 0 | g_ignore_leak (*item); |
151 | 0 | } |
152 | 0 | } Unexecuted instantiation: gmessages.c:g_ignore_strv_leak Unexecuted instantiation: gtestutils.c:g_ignore_strv_leak Unexecuted instantiation: gthread.c:g_ignore_strv_leak Unexecuted instantiation: guri.c:g_ignore_strv_leak Unexecuted instantiation: gutils.c:g_ignore_strv_leak Unexecuted instantiation: gvarianttypeinfo.c:g_ignore_strv_leak Unexecuted instantiation: gcharset.c:g_ignore_strv_leak Unexecuted instantiation: genviron.c:g_ignore_strv_leak Unexecuted instantiation: ggettext.c:g_ignore_strv_leak Unexecuted instantiation: ghash.c:g_ignore_strv_leak Unexecuted instantiation: glib-init.c:g_ignore_strv_leak Unexecuted instantiation: gmain.c:g_ignore_strv_leak Unexecuted instantiation: gquark.c:g_ignore_strv_leak Unexecuted instantiation: glib-unix.c:g_ignore_strv_leak Unexecuted instantiation: gthreadedresolver.c:g_ignore_strv_leak Unexecuted instantiation: gcancellable.c:g_ignore_strv_leak Unexecuted instantiation: gtask.c:g_ignore_strv_leak Unexecuted instantiation: giomodule.c:g_ignore_strv_leak Unexecuted instantiation: gproxyaddressenumerator.c:g_ignore_strv_leak Unexecuted instantiation: gvfs.c:g_ignore_strv_leak Unexecuted instantiation: gdesktopappinfo.c:g_ignore_strv_leak Unexecuted instantiation: gapplication.c:g_ignore_strv_leak Unexecuted instantiation: gdbusprivate.c:g_ignore_strv_leak Unexecuted instantiation: gportalsupport.c:g_ignore_strv_leak Unexecuted instantiation: glocalfilemonitor.c:g_ignore_strv_leak Unexecuted instantiation: gcontextspecificgroup.c:g_ignore_strv_leak Unexecuted instantiation: gresource.c:g_ignore_strv_leak Unexecuted instantiation: gunixfdlist.c:g_ignore_strv_leak Unexecuted instantiation: gcontenttype-fdo.c:g_ignore_strv_leak Unexecuted instantiation: gsettingsschema.c:g_ignore_strv_leak Unexecuted instantiation: gdbusaddress.c:g_ignore_strv_leak Unexecuted instantiation: gdbusauthmechanismsha1.c:g_ignore_strv_leak Unexecuted instantiation: glocalfile.c:g_ignore_strv_leak Unexecuted instantiation: glocalfileenumerator.c:g_ignore_strv_leak Unexecuted instantiation: glocalfileinfo.c:g_ignore_strv_leak Unexecuted instantiation: glocalfileinputstream.c:g_ignore_strv_leak Unexecuted instantiation: glocalfileoutputstream.c:g_ignore_strv_leak Unexecuted instantiation: glocalfileiostream.c:g_ignore_strv_leak Unexecuted instantiation: thumbnail-verify.c:g_ignore_strv_leak Unexecuted instantiation: gsubprocess.c:g_ignore_strv_leak Unexecuted instantiation: inotify-missing.c:g_ignore_strv_leak Unexecuted instantiation: inotify-kernel.c:g_ignore_strv_leak Unexecuted instantiation: gobject.c:g_ignore_strv_leak Unexecuted instantiation: gtype.c:g_ignore_strv_leak Unexecuted instantiation: gdir.c:g_ignore_strv_leak Unexecuted instantiation: glib-private.c:g_ignore_strv_leak Unexecuted instantiation: gthreadpool.c:g_ignore_strv_leak |
153 | | |
154 | | /* |
155 | | * g_begin_ignore_leaks: |
156 | | * |
157 | | * Tell AddressSanitizer and similar tools to ignore all leaks from this point |
158 | | * onwards, until g_end_ignore_leaks() is called. |
159 | | * |
160 | | * Try to use g_ignore_leak() where possible to target deliberate leaks more |
161 | | * specifically. |
162 | | */ |
163 | | static inline void |
164 | | g_begin_ignore_leaks (void) |
165 | 0 | { |
166 | | #if defined (_GLIB_ADDRESS_SANITIZER) |
167 | | __lsan_disable (); |
168 | | #elif defined (HAS_DYNAMIC_ASAN_LOADING) |
169 | 0 | if (G_UNLIKELY (__lsan_disable != NULL)) |
170 | 0 | __lsan_disable (); |
171 | 0 | #endif |
172 | 0 | } Unexecuted instantiation: gmessages.c:g_begin_ignore_leaks Unexecuted instantiation: gtestutils.c:g_begin_ignore_leaks Unexecuted instantiation: gthread.c:g_begin_ignore_leaks Unexecuted instantiation: guri.c:g_begin_ignore_leaks Unexecuted instantiation: gutils.c:g_begin_ignore_leaks Unexecuted instantiation: gvarianttypeinfo.c:g_begin_ignore_leaks Unexecuted instantiation: gcharset.c:g_begin_ignore_leaks Unexecuted instantiation: genviron.c:g_begin_ignore_leaks Unexecuted instantiation: ggettext.c:g_begin_ignore_leaks Unexecuted instantiation: ghash.c:g_begin_ignore_leaks Unexecuted instantiation: glib-init.c:g_begin_ignore_leaks Unexecuted instantiation: gmain.c:g_begin_ignore_leaks Unexecuted instantiation: gquark.c:g_begin_ignore_leaks Unexecuted instantiation: glib-unix.c:g_begin_ignore_leaks Unexecuted instantiation: gthreadedresolver.c:g_begin_ignore_leaks Unexecuted instantiation: gcancellable.c:g_begin_ignore_leaks Unexecuted instantiation: gtask.c:g_begin_ignore_leaks Unexecuted instantiation: giomodule.c:g_begin_ignore_leaks Unexecuted instantiation: gproxyaddressenumerator.c:g_begin_ignore_leaks Unexecuted instantiation: gvfs.c:g_begin_ignore_leaks Unexecuted instantiation: gdesktopappinfo.c:g_begin_ignore_leaks Unexecuted instantiation: gapplication.c:g_begin_ignore_leaks Unexecuted instantiation: gdbusprivate.c:g_begin_ignore_leaks Unexecuted instantiation: gportalsupport.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfilemonitor.c:g_begin_ignore_leaks Unexecuted instantiation: gcontextspecificgroup.c:g_begin_ignore_leaks Unexecuted instantiation: gresource.c:g_begin_ignore_leaks Unexecuted instantiation: gunixfdlist.c:g_begin_ignore_leaks Unexecuted instantiation: gcontenttype-fdo.c:g_begin_ignore_leaks Unexecuted instantiation: gsettingsschema.c:g_begin_ignore_leaks Unexecuted instantiation: gdbusaddress.c:g_begin_ignore_leaks Unexecuted instantiation: gdbusauthmechanismsha1.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfile.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfileenumerator.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfileinfo.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfileinputstream.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfileoutputstream.c:g_begin_ignore_leaks Unexecuted instantiation: glocalfileiostream.c:g_begin_ignore_leaks Unexecuted instantiation: thumbnail-verify.c:g_begin_ignore_leaks Unexecuted instantiation: gsubprocess.c:g_begin_ignore_leaks Unexecuted instantiation: inotify-missing.c:g_begin_ignore_leaks Unexecuted instantiation: inotify-kernel.c:g_begin_ignore_leaks Unexecuted instantiation: gobject.c:g_begin_ignore_leaks Unexecuted instantiation: gtype.c:g_begin_ignore_leaks Unexecuted instantiation: gdir.c:g_begin_ignore_leaks Unexecuted instantiation: glib-private.c:g_begin_ignore_leaks Unexecuted instantiation: gthreadpool.c:g_begin_ignore_leaks |
173 | | |
174 | | /* |
175 | | * g_end_ignore_leaks: |
176 | | * |
177 | | * Start ignoring leaks again; this must be paired with a previous call to |
178 | | * g_begin_ignore_leaks(). |
179 | | */ |
180 | | static inline void |
181 | | g_end_ignore_leaks (void) |
182 | 0 | { |
183 | | #if defined (_GLIB_ADDRESS_SANITIZER) |
184 | | __lsan_enable (); |
185 | | #elif defined (HAS_DYNAMIC_ASAN_LOADING) |
186 | 0 | if (G_UNLIKELY (__lsan_enable != NULL)) |
187 | 0 | __lsan_enable (); |
188 | 0 | #endif |
189 | 0 | } Unexecuted instantiation: gmessages.c:g_end_ignore_leaks Unexecuted instantiation: gtestutils.c:g_end_ignore_leaks Unexecuted instantiation: gthread.c:g_end_ignore_leaks Unexecuted instantiation: guri.c:g_end_ignore_leaks Unexecuted instantiation: gutils.c:g_end_ignore_leaks Unexecuted instantiation: gvarianttypeinfo.c:g_end_ignore_leaks Unexecuted instantiation: gcharset.c:g_end_ignore_leaks Unexecuted instantiation: genviron.c:g_end_ignore_leaks Unexecuted instantiation: ggettext.c:g_end_ignore_leaks Unexecuted instantiation: ghash.c:g_end_ignore_leaks Unexecuted instantiation: glib-init.c:g_end_ignore_leaks Unexecuted instantiation: gmain.c:g_end_ignore_leaks Unexecuted instantiation: gquark.c:g_end_ignore_leaks Unexecuted instantiation: glib-unix.c:g_end_ignore_leaks Unexecuted instantiation: gthreadedresolver.c:g_end_ignore_leaks Unexecuted instantiation: gcancellable.c:g_end_ignore_leaks Unexecuted instantiation: gtask.c:g_end_ignore_leaks Unexecuted instantiation: giomodule.c:g_end_ignore_leaks Unexecuted instantiation: gproxyaddressenumerator.c:g_end_ignore_leaks Unexecuted instantiation: gvfs.c:g_end_ignore_leaks Unexecuted instantiation: gdesktopappinfo.c:g_end_ignore_leaks Unexecuted instantiation: gapplication.c:g_end_ignore_leaks Unexecuted instantiation: gdbusprivate.c:g_end_ignore_leaks Unexecuted instantiation: gportalsupport.c:g_end_ignore_leaks Unexecuted instantiation: glocalfilemonitor.c:g_end_ignore_leaks Unexecuted instantiation: gcontextspecificgroup.c:g_end_ignore_leaks Unexecuted instantiation: gresource.c:g_end_ignore_leaks Unexecuted instantiation: gunixfdlist.c:g_end_ignore_leaks Unexecuted instantiation: gcontenttype-fdo.c:g_end_ignore_leaks Unexecuted instantiation: gsettingsschema.c:g_end_ignore_leaks Unexecuted instantiation: gdbusaddress.c:g_end_ignore_leaks Unexecuted instantiation: gdbusauthmechanismsha1.c:g_end_ignore_leaks Unexecuted instantiation: glocalfile.c:g_end_ignore_leaks Unexecuted instantiation: glocalfileenumerator.c:g_end_ignore_leaks Unexecuted instantiation: glocalfileinfo.c:g_end_ignore_leaks Unexecuted instantiation: glocalfileinputstream.c:g_end_ignore_leaks Unexecuted instantiation: glocalfileoutputstream.c:g_end_ignore_leaks Unexecuted instantiation: glocalfileiostream.c:g_end_ignore_leaks Unexecuted instantiation: thumbnail-verify.c:g_end_ignore_leaks Unexecuted instantiation: gsubprocess.c:g_end_ignore_leaks Unexecuted instantiation: inotify-missing.c:g_end_ignore_leaks Unexecuted instantiation: inotify-kernel.c:g_end_ignore_leaks Unexecuted instantiation: gobject.c:g_end_ignore_leaks Unexecuted instantiation: gtype.c:g_end_ignore_leaks Unexecuted instantiation: gdir.c:g_end_ignore_leaks Unexecuted instantiation: glib-private.c:g_end_ignore_leaks Unexecuted instantiation: gthreadpool.c:g_end_ignore_leaks |
190 | | |
191 | | #undef HAS_DYNAMIC_ASAN_LOADING |
192 | | |
193 | | GMainContext * g_get_worker_context (void); |
194 | | gboolean g_check_setuid (void); |
195 | | GMainContext * g_main_context_new_with_next_id (guint next_id); |
196 | | |
197 | | #if (defined (HAVE__SET_THREAD_LOCAL_INVALID_PARAMETER_HANDLER) || \ |
198 | | defined (HAVE__SET_INVALID_PARAMETER_HANDLER)) && \ |
199 | | defined (HAVE__CRT_SET_REPORT_MODE) |
200 | | # define USE_INVALID_PARAMETER_HANDLER |
201 | | #endif |
202 | | |
203 | | #ifdef USE_INVALID_PARAMETER_HANDLER |
204 | | struct _GWin32InvalidParameterHandler |
205 | | { |
206 | | _invalid_parameter_handler old_handler; |
207 | | _invalid_parameter_handler pushed_handler; |
208 | | int prev_report_mode; |
209 | | int pushed_report_mode; |
210 | | }; |
211 | | #else |
212 | | struct _GWin32InvalidParameterHandler |
213 | | { |
214 | | int unused_really; |
215 | | }; |
216 | | #endif |
217 | | |
218 | | #ifdef G_OS_WIN32 |
219 | | GLIB_AVAILABLE_IN_ALL |
220 | | gchar *_glib_get_locale_dir (void); |
221 | | #endif |
222 | | |
223 | | GDir * g_dir_open_with_errno (const gchar *path, guint flags); |
224 | | GDir * g_dir_new_from_dirp (gpointer dirp); |
225 | | |
226 | | typedef struct _GWin32InvalidParameterHandler GWin32InvalidParameterHandler; |
227 | | void g_win32_push_empty_invalid_parameter_handler (GWin32InvalidParameterHandler *items); |
228 | | void g_win32_pop_invalid_parameter_handler (GWin32InvalidParameterHandler *items); |
229 | | |
230 | | char *g_find_program_for_path (const char *program, |
231 | | const char *path, |
232 | | const char *working_dir); |
233 | | |
234 | | int g_uri_get_default_scheme_port (const char *scheme); |
235 | | |
236 | 2 | #define GLIB_PRIVATE_CALL(symbol) (glib__private__()->symbol) |
237 | | |
238 | | |
239 | | typedef struct { |
240 | | /* See gwakeup.c */ |
241 | | GWakeup * (* g_wakeup_new) (void); |
242 | | void (* g_wakeup_free) (GWakeup *wakeup); |
243 | | void (* g_wakeup_get_pollfd) (GWakeup *wakeup, |
244 | | GPollFD *poll_fd); |
245 | | void (* g_wakeup_signal) (GWakeup *wakeup); |
246 | | void (* g_wakeup_acknowledge) (GWakeup *wakeup); |
247 | | |
248 | | /* See gmain.c */ |
249 | | GMainContext * (* g_get_worker_context) (void); |
250 | | |
251 | | gboolean (* g_check_setuid) (void); |
252 | | GMainContext * (* g_main_context_new_with_next_id) (guint next_id); |
253 | | |
254 | | GDir * (* g_dir_open_with_errno) (const gchar *path, |
255 | | guint flags); |
256 | | GDir * (* g_dir_new_from_dirp) (gpointer dirp); |
257 | | |
258 | | /* See glib-init.c */ |
259 | | void (* glib_init) (void); |
260 | | |
261 | | /* See gstdio.c */ |
262 | | #ifdef G_OS_WIN32 |
263 | | int (* g_win32_stat_utf8) (const gchar *filename, |
264 | | GWin32PrivateStat *buf); |
265 | | |
266 | | int (* g_win32_lstat_utf8) (const gchar *filename, |
267 | | GWin32PrivateStat *buf); |
268 | | |
269 | | int (* g_win32_readlink_utf8) (const gchar *filename, |
270 | | gchar *buf, |
271 | | gsize buf_size, |
272 | | gchar **alloc_buf, |
273 | | gboolean terminate); |
274 | | |
275 | | int (* g_win32_fstat) (int fd, |
276 | | GWin32PrivateStat *buf); |
277 | | |
278 | | /* See gwin32.c */ |
279 | | gchar *(*g_win32_find_helper_executable_path) (const gchar *process_name, |
280 | | void *dll_handle); |
281 | | |
282 | | int (* g_win32_reopen_noninherited) (int fd, |
283 | | int mode, |
284 | | GError **err); |
285 | | |
286 | | gboolean (* g_win32_handle_is_socket) (void *handle); |
287 | | |
288 | | #endif |
289 | | |
290 | | /* See glib-private.c */ |
291 | | void (* g_win32_push_empty_invalid_parameter_handler) (GWin32InvalidParameterHandler *items); |
292 | | |
293 | | void (* g_win32_pop_invalid_parameter_handler) (GWin32InvalidParameterHandler *items); |
294 | | |
295 | | /* See gutils.c */ |
296 | | char *(* g_find_program_for_path) (const char *program, |
297 | | const char *path, |
298 | | const char *working_dir); |
299 | | |
300 | | /* See guri.c */ |
301 | | int (* g_uri_get_default_scheme_port) (const char *scheme); |
302 | | |
303 | | /* See gutils.c */ |
304 | | gboolean (* g_set_prgname_once) (const gchar *prgname); |
305 | | |
306 | | gpointer (*g_datalist_id_update_atomic) (GData **datalist, |
307 | | GQuark key_id, |
308 | | gboolean already_locked, |
309 | | GDataListUpdateAtomicFunc callback, |
310 | | gpointer user_data); |
311 | | |
312 | | /* Add other private functions here, initialize them in glib-private.c */ |
313 | | } GLibPrivateVTable; |
314 | | |
315 | | GLIB_AVAILABLE_IN_ALL |
316 | | const GLibPrivateVTable *glib__private__ (void); |
317 | | |
318 | | /* Please see following for the use of ".ACP" over "" |
319 | | * on Windows, although both are accepted at compile-time |
320 | | * but "" renders translated console messages unreadable if |
321 | | * built with Visual Studio 2012 and later (this is, unfortunately, |
322 | | * undocumented): |
323 | | * |
324 | | * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale |
325 | | * https://gitlab.gnome.org/GNOME/glib/merge_requests/895#note_525881 |
326 | | * https://gitlab.gnome.org/GNOME/glib/merge_requests/895#note_525900 |
327 | | * |
328 | | * Additional related items: |
329 | | * https://stackoverflow.com/questions/22604329/php-5-5-setlocale-not-working-in-cli-on-windows |
330 | | * https://bugs.php.net/bug.php?id=66265 |
331 | | */ |
332 | | |
333 | | #ifdef G_OS_WIN32 |
334 | | # define GLIB_DEFAULT_LOCALE ".ACP" |
335 | | #else |
336 | | # define GLIB_DEFAULT_LOCALE "" |
337 | | #endif |
338 | | |
339 | | gboolean g_uint_equal (gconstpointer v1, gconstpointer v2); |
340 | | guint g_uint_hash (gconstpointer v); |
341 | | |
342 | | #if defined(__GNUC__) |
343 | | #define G_THREAD_LOCAL __thread |
344 | | #else |
345 | | #undef G_THREAD_LOCAL |
346 | | #endif |
347 | | |
348 | | /* Convenience wrapper to call private g_datalist_id_update_atomic() function. */ |
349 | | #define _g_datalist_id_update_atomic_full(datalist, key_id, already_locked, callback, user_data) \ |
350 | | (GLIB_PRIVATE_CALL (g_datalist_id_update_atomic) ((datalist), (key_id), (already_locked), (callback), (user_data))) |
351 | | |
352 | | #define _g_datalist_id_update_atomic(datalist, key_id, callback, user_data) \ |
353 | 0 | _g_datalist_id_update_atomic_full ((datalist), (key_id), FALSE, (callback), (user_data)) |
354 | | |
355 | | #endif /* __GLIB_PRIVATE_H__ */ |