Coverage Report

Created: 2025-11-24 06:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/irssi/subprojects/glib-2.74.3/glib/gutils.h
Line
Count
Source
1
/* GLIB - Library of useful routines for C programming
2
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
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
17
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
/*
21
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22
 * file for a list of people on the GLib Team.  See the ChangeLog
23
 * files for a list of changes.  These files are distributed with
24
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25
 */
26
27
#ifndef __G_UTILS_H__
28
#define __G_UTILS_H__
29
30
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31
#error "Only <glib.h> can be included directly."
32
#endif
33
34
#include <glib/gtypes.h>
35
#include <stdarg.h>
36
37
G_BEGIN_DECLS
38
39
/* Define G_VA_COPY() to do the right thing for copying va_list variables.
40
 * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
41
 */
42
#if !defined (G_VA_COPY)
43
#  if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
44
#    define G_VA_COPY(ap1, ap2)   (*(ap1) = *(ap2))
45
#  elif defined (G_VA_COPY_AS_ARRAY)
46
#    define G_VA_COPY(ap1, ap2)   memmove ((ap1), (ap2), sizeof (va_list))
47
#  else /* va_list is a pointer */
48
#    define G_VA_COPY(ap1, ap2)   ((ap1) = (ap2))
49
#  endif /* va_list is a pointer */
50
#endif /* !G_VA_COPY */
51
52
GLIB_AVAILABLE_IN_ALL
53
const gchar *         g_get_user_name        (void);
54
GLIB_AVAILABLE_IN_ALL
55
const gchar *         g_get_real_name        (void);
56
GLIB_AVAILABLE_IN_ALL
57
const gchar *         g_get_home_dir         (void);
58
GLIB_AVAILABLE_IN_ALL
59
const gchar *         g_get_tmp_dir          (void);
60
GLIB_AVAILABLE_IN_ALL
61
const gchar *         g_get_host_name      (void);
62
GLIB_AVAILABLE_IN_ALL
63
const gchar *         g_get_prgname          (void);
64
GLIB_AVAILABLE_IN_ALL
65
void                  g_set_prgname          (const gchar *prgname);
66
GLIB_AVAILABLE_IN_ALL
67
const gchar *         g_get_application_name (void);
68
GLIB_AVAILABLE_IN_ALL
69
void                  g_set_application_name (const gchar *application_name);
70
GLIB_AVAILABLE_IN_2_64
71
gchar *               g_get_os_info          (const gchar *key_name);
72
73
/**
74
 * G_OS_INFO_KEY_NAME:
75
 *
76
 * A key to get the name of the operating system excluding version information suitable for presentation to the user, e.g. "YoYoOS"
77
 *
78
 * Since: 2.64
79
 */
80
#define G_OS_INFO_KEY_NAME \
81
0
    GLIB_AVAILABLE_MACRO_IN_2_64 \
82
0
    "NAME"
83
84
/**
85
 * G_OS_INFO_KEY_PRETTY_NAME:
86
 *
87
 * A key to get the name of the operating system in a format suitable for presentation to the user, e.g. "YoYoOS Foo"
88
 *
89
 * Since: 2.64
90
 */
91
#define G_OS_INFO_KEY_PRETTY_NAME \
92
0
    GLIB_AVAILABLE_MACRO_IN_2_64 \
93
0
    "PRETTY_NAME"
94
95
/**
96
 * G_OS_INFO_KEY_VERSION:
97
 *
98
 * A key to get the operating system version suitable for presentation to the user, e.g. "42 (Foo)"
99
 *
100
 * Since: 2.64
101
 */
102
#define G_OS_INFO_KEY_VERSION \
103
0
    GLIB_AVAILABLE_MACRO_IN_2_64 \
104
0
    "VERSION"
105
106
/**
107
 * G_OS_INFO_KEY_VERSION_CODENAME:
108
 *
109
 * A key to get a codename identifying the operating system release suitable for processing by scripts or usage in generated filenames, e.g. "foo"
110
 *
111
 * Since: 2.64
112
 */
113
#define G_OS_INFO_KEY_VERSION_CODENAME \
114
    GLIB_AVAILABLE_MACRO_IN_2_64 \
115
    "VERSION_CODENAME"
116
117
/**
118
 * G_OS_INFO_KEY_VERSION_ID:
119
 *
120
 * A key to get the version of the operating system suitable for processing by scripts or usage in generated filenames, e.g. "42"
121
 *
122
 * Since: 2.64
123
 */
124
#define G_OS_INFO_KEY_VERSION_ID \
125
0
    GLIB_AVAILABLE_MACRO_IN_2_64 \
126
0
    "VERSION_ID"
127
128
/**
129
 * G_OS_INFO_KEY_ID:
130
 *
131
 * A key to get an ID identifying the operating system suitable for processing by scripts or usage in generated filenames, e.g. "yoyoos"
132
 *
133
 * Since: 2.64
134
 */
135
#define G_OS_INFO_KEY_ID \
136
0
    GLIB_AVAILABLE_MACRO_IN_2_64 \
137
0
    "ID"
138
139
/**
140
 * G_OS_INFO_KEY_HOME_URL:
141
 *
142
 * A key to get the homepage for the operating system, e.g. "https://www.yoyo-os.com/"
143
 *
144
 * Since: 2.64
145
 */
146
#define G_OS_INFO_KEY_HOME_URL \
147
    GLIB_AVAILABLE_MACRO_IN_2_64 \
148
    "HOME_URL"
149
150
/**
151
 * G_OS_INFO_KEY_DOCUMENTATION_URL:
152
 *
153
 * A key to get the documentation page for the operating system, e.g. "https://docs.yoyo-os.com/"
154
 *
155
 * Since: 2.64
156
 */
157
#define G_OS_INFO_KEY_DOCUMENTATION_URL \
158
    GLIB_AVAILABLE_MACRO_IN_2_64 \
159
    "DOCUMENTATION_URL"
160
161
/**
162
 * G_OS_INFO_KEY_SUPPORT_URL:
163
 *
164
 * A key to get the support page for the operating system, e.g. "https://support.yoyo-os.com/"
165
 *
166
 * Since: 2.64
167
 */
168
#define G_OS_INFO_KEY_SUPPORT_URL \
169
    GLIB_AVAILABLE_MACRO_IN_2_64 \
170
    "SUPPORT_URL"
171
172
/**
173
 * G_OS_INFO_KEY_BUG_REPORT_URL:
174
 *
175
 * A key to get the bug reporting page for the operating system, e.g. "https://bugs.yoyo-os.com/"
176
 *
177
 * Since: 2.64
178
 */
179
#define G_OS_INFO_KEY_BUG_REPORT_URL \
180
    GLIB_AVAILABLE_MACRO_IN_2_64 \
181
    "BUG_REPORT_URL"
182
183
/**
184
 * G_OS_INFO_KEY_PRIVACY_POLICY_URL:
185
 *
186
 * A key to get the privacy policy for the operating system, e.g. "https://privacy.yoyo-os.com/"
187
 *
188
 * Since: 2.64
189
 */
190
#define G_OS_INFO_KEY_PRIVACY_POLICY_URL \
191
    GLIB_AVAILABLE_MACRO_IN_2_64 \
192
    "PRIVACY_POLICY_URL"
193
194
GLIB_AVAILABLE_IN_ALL
195
void      g_reload_user_special_dirs_cache     (void);
196
GLIB_AVAILABLE_IN_ALL
197
const gchar *         g_get_user_data_dir      (void);
198
GLIB_AVAILABLE_IN_ALL
199
const gchar *         g_get_user_config_dir    (void);
200
GLIB_AVAILABLE_IN_ALL
201
const gchar *         g_get_user_cache_dir     (void);
202
GLIB_AVAILABLE_IN_2_72
203
const gchar *         g_get_user_state_dir     (void);
204
GLIB_AVAILABLE_IN_ALL
205
const gchar * const * g_get_system_data_dirs   (void);
206
207
#ifdef G_OS_WIN32
208
/* This function is not part of the public GLib API */
209
GLIB_AVAILABLE_IN_ALL
210
const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void));
211
#endif
212
213
#if defined (G_OS_WIN32) && defined (G_CAN_INLINE)
214
/* This function is not part of the public GLib API either. Just call
215
 * g_get_system_data_dirs() in your code, never mind that that is
216
 * actually a macro and you will in fact call this inline function.
217
 */
218
static inline const gchar * const *
219
_g_win32_get_system_data_dirs (void)
220
{
221
  return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs);
222
}
223
#define g_get_system_data_dirs _g_win32_get_system_data_dirs
224
#endif
225
226
GLIB_AVAILABLE_IN_ALL
227
const gchar * const * g_get_system_config_dirs (void);
228
229
GLIB_AVAILABLE_IN_ALL
230
const gchar * g_get_user_runtime_dir (void);
231
232
/**
233
 * GUserDirectory:
234
 * @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory
235
 * @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory
236
 * @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory
237
 * @G_USER_DIRECTORY_MUSIC: the user's Music directory
238
 * @G_USER_DIRECTORY_PICTURES: the user's Pictures directory
239
 * @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory
240
 * @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory
241
 * @G_USER_DIRECTORY_VIDEOS: the user's Movies directory
242
 * @G_USER_N_DIRECTORIES: the number of enum values
243
 *
244
 * These are logical ids for special directories which are defined
245
 * depending on the platform used. You should use g_get_user_special_dir()
246
 * to retrieve the full path associated to the logical id.
247
 *
248
 * The #GUserDirectory enumeration can be extended at later date. Not
249
 * every platform has a directory for every logical id in this
250
 * enumeration.
251
 *
252
 * Since: 2.14
253
 */
254
typedef enum {
255
  G_USER_DIRECTORY_DESKTOP,
256
  G_USER_DIRECTORY_DOCUMENTS,
257
  G_USER_DIRECTORY_DOWNLOAD,
258
  G_USER_DIRECTORY_MUSIC,
259
  G_USER_DIRECTORY_PICTURES,
260
  G_USER_DIRECTORY_PUBLIC_SHARE,
261
  G_USER_DIRECTORY_TEMPLATES,
262
  G_USER_DIRECTORY_VIDEOS,
263
264
  G_USER_N_DIRECTORIES
265
} GUserDirectory;
266
267
GLIB_AVAILABLE_IN_ALL
268
const gchar * g_get_user_special_dir (GUserDirectory directory);
269
270
/**
271
 * GDebugKey:
272
 * @key: the string
273
 * @value: the flag
274
 *
275
 * Associates a string with a bit flag.
276
 * Used in g_parse_debug_string().
277
 */
278
typedef struct _GDebugKey GDebugKey;
279
struct _GDebugKey
280
{
281
  const gchar *key;
282
  guint        value;
283
};
284
285
/* Miscellaneous utility functions
286
 */
287
GLIB_AVAILABLE_IN_ALL
288
guint                 g_parse_debug_string (const gchar     *string,
289
              const GDebugKey *keys,
290
              guint            nkeys);
291
292
GLIB_AVAILABLE_IN_ALL
293
gint                  g_snprintf           (gchar       *string,
294
              gulong       n,
295
              gchar const *format,
296
              ...) G_GNUC_PRINTF (3, 4);
297
GLIB_AVAILABLE_IN_ALL
298
gint                  g_vsnprintf          (gchar       *string,
299
              gulong       n,
300
              gchar const *format,
301
              va_list      args)
302
              G_GNUC_PRINTF(3, 0);
303
304
GLIB_AVAILABLE_IN_ALL
305
void                  g_nullify_pointer    (gpointer    *nullify_location);
306
307
typedef enum
308
{
309
  G_FORMAT_SIZE_DEFAULT     = 0,
310
  G_FORMAT_SIZE_LONG_FORMAT = 1 << 0,
311
  G_FORMAT_SIZE_IEC_UNITS   = 1 << 1,
312
  G_FORMAT_SIZE_BITS        = 1 << 2,
313
  G_FORMAT_SIZE_ONLY_VALUE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 3,
314
  G_FORMAT_SIZE_ONLY_UNIT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 4
315
} GFormatSizeFlags;
316
317
GLIB_AVAILABLE_IN_2_30
318
gchar *g_format_size_full   (guint64          size,
319
                             GFormatSizeFlags flags);
320
GLIB_AVAILABLE_IN_2_30
321
gchar *g_format_size        (guint64          size);
322
323
GLIB_DEPRECATED_IN_2_30_FOR(g_format_size)
324
gchar *g_format_size_for_display (goffset size);
325
326
#define g_ATEXIT(proc)  (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32
327
#define g_memmove(dest,src,len) \
328
  G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END  GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove)
329
330
/**
331
 * GVoidFunc:
332
 *
333
 * Declares a type of function which takes no arguments
334
 * and has no return value. It is used to specify the type
335
 * function passed to g_atexit().
336
 */
337
typedef void (*GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32;
338
#define ATEXIT(proc) g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32
339
340
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
341
GLIB_DEPRECATED
342
void  g_atexit    (GVoidFunc    func);
343
G_GNUC_END_IGNORE_DEPRECATIONS
344
345
#ifdef G_OS_WIN32
346
/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls
347
 * atexit(), the function will be called when the GLib DLL is detached
348
 * from the program, which is not what the caller wants. The caller
349
 * wants the function to be called when it *itself* exits (or is
350
 * detached, in case the caller, too, is a DLL).
351
 */
352
#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB))
353
int atexit (void (*)(void));
354
#endif
355
#define g_atexit(func) atexit(func) GLIB_DEPRECATED_MACRO_IN_2_32
356
#endif
357
358
359
/* Look for an executable in PATH, following execvp() rules */
360
GLIB_AVAILABLE_IN_ALL
361
gchar*  g_find_program_in_path  (const gchar *program);
362
363
/* Bit tests
364
 *
365
 * These are defined in a convoluted way because we want the compiler to
366
 * be able to inline the code for performance reasons, but for
367
 * historical reasons, we must continue to provide non-inline versions
368
 * on our ABI.
369
 *
370
 * We define these as functions in gutils.c which are just implemented
371
 * as calls to the _impl() versions in order to preserve the ABI.
372
 */
373
374
#define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit)
375
3.51M
#define g_bit_nth_msf(mask, nth_bit) g_bit_nth_msf_impl(mask, nth_bit)
376
51.9k
#define g_bit_storage(number)        g_bit_storage_impl(number)
377
378
GLIB_AVAILABLE_IN_ALL
379
gint    (g_bit_nth_lsf)         (gulong mask,
380
                                 gint   nth_bit);
381
GLIB_AVAILABLE_IN_ALL
382
gint    (g_bit_nth_msf)         (gulong mask,
383
                                 gint   nth_bit);
384
GLIB_AVAILABLE_IN_ALL
385
guint   (g_bit_storage)         (gulong number);
386
387
static inline gint
388
g_bit_nth_lsf_impl (gulong mask,
389
                    gint   nth_bit)
390
0
{
391
0
  if (G_UNLIKELY (nth_bit < -1))
392
0
    nth_bit = -1;
393
0
  while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1))
394
0
    {
395
0
      nth_bit++;
396
0
      if (mask & (1UL << nth_bit))
397
0
        return nth_bit;
398
0
    }
399
0
  return -1;
400
0
}
Unexecuted instantiation: gcharset.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gconvert.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gdatetime.c:g_bit_nth_lsf_impl
Unexecuted instantiation: genviron.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gerror.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gfileutils.c:g_bit_nth_lsf_impl
Unexecuted instantiation: ggettext.c:g_bit_nth_lsf_impl
Unexecuted instantiation: ghash.c:g_bit_nth_lsf_impl
Unexecuted instantiation: giochannel.c:g_bit_nth_lsf_impl
Unexecuted instantiation: glist.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gmain.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gmem.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gmessages.c:g_bit_nth_lsf_impl
Unexecuted instantiation: goption.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gpattern.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gpoll.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gquark.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gqueue.c:g_bit_nth_lsf_impl
Unexecuted instantiation: grefcount.c:g_bit_nth_lsf_impl
Unexecuted instantiation: grefstring.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gregex.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gsequence.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gslice.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gslist.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gstdio.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gstrfuncs.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gstring.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gtestutils.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gthread.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gtimer.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gtimezone.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gtranslit.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gtree.c:g_bit_nth_lsf_impl
Unexecuted instantiation: guniprop.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gutf8.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gunidecomp.c:g_bit_nth_lsf_impl
Unexecuted instantiation: guri.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gutils.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gvariant.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gvariant-core.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gvariant-serialiser.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gvarianttypeinfo.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gvarianttype.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gwakeup.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gprintf.c:g_bit_nth_lsf_impl
Unexecuted instantiation: glib-unix.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gspawn.c:g_bit_nth_lsf_impl
Unexecuted instantiation: giounix.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gthread-posix.c:g_bit_nth_lsf_impl
Unexecuted instantiation: garcbox.c:g_bit_nth_lsf_impl
Unexecuted instantiation: garray.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gbitlock.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gbytes.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gdate.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gdir.c:g_bit_nth_lsf_impl
Unexecuted instantiation: ghostutils.c:g_bit_nth_lsf_impl
Unexecuted instantiation: glib-init.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gmappedfile.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gqsort.c:g_bit_nth_lsf_impl
Unexecuted instantiation: grand.c:g_bit_nth_lsf_impl
Unexecuted instantiation: grcbox.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gshell.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gscanner.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gdataset.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gmodule.c:g_bit_nth_lsf_impl
Unexecuted instantiation: gbase64.c:g_bit_nth_lsf_impl
401
402
static inline gint
403
g_bit_nth_msf_impl (gulong mask,
404
                    gint   nth_bit)
405
3.51M
{
406
3.51M
  if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8))
407
1.75M
    nth_bit = GLIB_SIZEOF_LONG * 8;
408
114M
  while (nth_bit > 0)
409
112M
    {
410
112M
      nth_bit--;
411
112M
      if (mask & (1UL << nth_bit))
412
1.75M
        return nth_bit;
413
112M
    }
414
1.75M
  return -1;
415
3.51M
}
Unexecuted instantiation: gcharset.c:g_bit_nth_msf_impl
Unexecuted instantiation: gconvert.c:g_bit_nth_msf_impl
Unexecuted instantiation: gdatetime.c:g_bit_nth_msf_impl
Unexecuted instantiation: genviron.c:g_bit_nth_msf_impl
Unexecuted instantiation: gerror.c:g_bit_nth_msf_impl
Unexecuted instantiation: gfileutils.c:g_bit_nth_msf_impl
Unexecuted instantiation: ggettext.c:g_bit_nth_msf_impl
Unexecuted instantiation: ghash.c:g_bit_nth_msf_impl
Unexecuted instantiation: giochannel.c:g_bit_nth_msf_impl
Unexecuted instantiation: glist.c:g_bit_nth_msf_impl
Unexecuted instantiation: gmain.c:g_bit_nth_msf_impl
Unexecuted instantiation: gmem.c:g_bit_nth_msf_impl
gmessages.c:g_bit_nth_msf_impl
Line
Count
Source
405
3.51M
{
406
3.51M
  if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8))
407
1.75M
    nth_bit = GLIB_SIZEOF_LONG * 8;
408
114M
  while (nth_bit > 0)
409
112M
    {
410
112M
      nth_bit--;
411
112M
      if (mask & (1UL << nth_bit))
412
1.75M
        return nth_bit;
413
112M
    }
414
1.75M
  return -1;
415
3.51M
}
Unexecuted instantiation: goption.c:g_bit_nth_msf_impl
Unexecuted instantiation: gpattern.c:g_bit_nth_msf_impl
Unexecuted instantiation: gpoll.c:g_bit_nth_msf_impl
Unexecuted instantiation: gquark.c:g_bit_nth_msf_impl
Unexecuted instantiation: gqueue.c:g_bit_nth_msf_impl
Unexecuted instantiation: grefcount.c:g_bit_nth_msf_impl
Unexecuted instantiation: grefstring.c:g_bit_nth_msf_impl
Unexecuted instantiation: gregex.c:g_bit_nth_msf_impl
Unexecuted instantiation: gsequence.c:g_bit_nth_msf_impl
Unexecuted instantiation: gslice.c:g_bit_nth_msf_impl
Unexecuted instantiation: gslist.c:g_bit_nth_msf_impl
Unexecuted instantiation: gstdio.c:g_bit_nth_msf_impl
Unexecuted instantiation: gstrfuncs.c:g_bit_nth_msf_impl
Unexecuted instantiation: gstring.c:g_bit_nth_msf_impl
Unexecuted instantiation: gtestutils.c:g_bit_nth_msf_impl
Unexecuted instantiation: gthread.c:g_bit_nth_msf_impl
Unexecuted instantiation: gtimer.c:g_bit_nth_msf_impl
Unexecuted instantiation: gtimezone.c:g_bit_nth_msf_impl
Unexecuted instantiation: gtranslit.c:g_bit_nth_msf_impl
Unexecuted instantiation: gtree.c:g_bit_nth_msf_impl
Unexecuted instantiation: guniprop.c:g_bit_nth_msf_impl
Unexecuted instantiation: gutf8.c:g_bit_nth_msf_impl
Unexecuted instantiation: gunidecomp.c:g_bit_nth_msf_impl
Unexecuted instantiation: guri.c:g_bit_nth_msf_impl
Unexecuted instantiation: gutils.c:g_bit_nth_msf_impl
Unexecuted instantiation: gvariant.c:g_bit_nth_msf_impl
Unexecuted instantiation: gvariant-core.c:g_bit_nth_msf_impl
Unexecuted instantiation: gvariant-serialiser.c:g_bit_nth_msf_impl
Unexecuted instantiation: gvarianttypeinfo.c:g_bit_nth_msf_impl
Unexecuted instantiation: gvarianttype.c:g_bit_nth_msf_impl
Unexecuted instantiation: gwakeup.c:g_bit_nth_msf_impl
Unexecuted instantiation: gprintf.c:g_bit_nth_msf_impl
Unexecuted instantiation: glib-unix.c:g_bit_nth_msf_impl
Unexecuted instantiation: gspawn.c:g_bit_nth_msf_impl
Unexecuted instantiation: giounix.c:g_bit_nth_msf_impl
Unexecuted instantiation: gthread-posix.c:g_bit_nth_msf_impl
Unexecuted instantiation: garcbox.c:g_bit_nth_msf_impl
Unexecuted instantiation: garray.c:g_bit_nth_msf_impl
Unexecuted instantiation: gbitlock.c:g_bit_nth_msf_impl
Unexecuted instantiation: gbytes.c:g_bit_nth_msf_impl
Unexecuted instantiation: gdate.c:g_bit_nth_msf_impl
Unexecuted instantiation: gdir.c:g_bit_nth_msf_impl
Unexecuted instantiation: ghostutils.c:g_bit_nth_msf_impl
Unexecuted instantiation: glib-init.c:g_bit_nth_msf_impl
Unexecuted instantiation: gmappedfile.c:g_bit_nth_msf_impl
Unexecuted instantiation: gqsort.c:g_bit_nth_msf_impl
Unexecuted instantiation: grand.c:g_bit_nth_msf_impl
Unexecuted instantiation: grcbox.c:g_bit_nth_msf_impl
Unexecuted instantiation: gshell.c:g_bit_nth_msf_impl
Unexecuted instantiation: gscanner.c:g_bit_nth_msf_impl
Unexecuted instantiation: gdataset.c:g_bit_nth_msf_impl
Unexecuted instantiation: gmodule.c:g_bit_nth_msf_impl
Unexecuted instantiation: gbase64.c:g_bit_nth_msf_impl
416
417
static inline guint
418
g_bit_storage_impl (gulong number)
419
51.9k
{
420
51.9k
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
421
51.9k
  return G_LIKELY (number) ?
422
51.9k
           ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1;
423
#else
424
  guint n_bits = 0;
425
426
  do
427
    {
428
      n_bits++;
429
      number >>= 1;
430
    }
431
  while (number);
432
  return n_bits;
433
#endif
434
51.9k
}
Unexecuted instantiation: gcharset.c:g_bit_storage_impl
Unexecuted instantiation: gconvert.c:g_bit_storage_impl
Unexecuted instantiation: gdatetime.c:g_bit_storage_impl
Unexecuted instantiation: genviron.c:g_bit_storage_impl
Unexecuted instantiation: gerror.c:g_bit_storage_impl
Unexecuted instantiation: gfileutils.c:g_bit_storage_impl
Unexecuted instantiation: ggettext.c:g_bit_storage_impl
Unexecuted instantiation: ghash.c:g_bit_storage_impl
Unexecuted instantiation: giochannel.c:g_bit_storage_impl
Unexecuted instantiation: glist.c:g_bit_storage_impl
Unexecuted instantiation: gmain.c:g_bit_storage_impl
Unexecuted instantiation: gmem.c:g_bit_storage_impl
Unexecuted instantiation: gmessages.c:g_bit_storage_impl
Unexecuted instantiation: goption.c:g_bit_storage_impl
Unexecuted instantiation: gpattern.c:g_bit_storage_impl
Unexecuted instantiation: gpoll.c:g_bit_storage_impl
Unexecuted instantiation: gquark.c:g_bit_storage_impl
Unexecuted instantiation: gqueue.c:g_bit_storage_impl
Unexecuted instantiation: grefcount.c:g_bit_storage_impl
Unexecuted instantiation: grefstring.c:g_bit_storage_impl
Unexecuted instantiation: gregex.c:g_bit_storage_impl
Unexecuted instantiation: gsequence.c:g_bit_storage_impl
gslice.c:g_bit_storage_impl
Line
Count
Source
419
51.9k
{
420
51.9k
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
421
51.9k
  return G_LIKELY (number) ?
422
51.9k
           ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1;
423
#else
424
  guint n_bits = 0;
425
426
  do
427
    {
428
      n_bits++;
429
      number >>= 1;
430
    }
431
  while (number);
432
  return n_bits;
433
#endif
434
51.9k
}
Unexecuted instantiation: gslist.c:g_bit_storage_impl
Unexecuted instantiation: gstdio.c:g_bit_storage_impl
Unexecuted instantiation: gstrfuncs.c:g_bit_storage_impl
Unexecuted instantiation: gstring.c:g_bit_storage_impl
Unexecuted instantiation: gtestutils.c:g_bit_storage_impl
Unexecuted instantiation: gthread.c:g_bit_storage_impl
Unexecuted instantiation: gtimer.c:g_bit_storage_impl
Unexecuted instantiation: gtimezone.c:g_bit_storage_impl
Unexecuted instantiation: gtranslit.c:g_bit_storage_impl
Unexecuted instantiation: gtree.c:g_bit_storage_impl
Unexecuted instantiation: guniprop.c:g_bit_storage_impl
Unexecuted instantiation: gutf8.c:g_bit_storage_impl
Unexecuted instantiation: gunidecomp.c:g_bit_storage_impl
Unexecuted instantiation: guri.c:g_bit_storage_impl
Unexecuted instantiation: gutils.c:g_bit_storage_impl
Unexecuted instantiation: gvariant.c:g_bit_storage_impl
Unexecuted instantiation: gvariant-core.c:g_bit_storage_impl
Unexecuted instantiation: gvariant-serialiser.c:g_bit_storage_impl
Unexecuted instantiation: gvarianttypeinfo.c:g_bit_storage_impl
Unexecuted instantiation: gvarianttype.c:g_bit_storage_impl
Unexecuted instantiation: gwakeup.c:g_bit_storage_impl
Unexecuted instantiation: gprintf.c:g_bit_storage_impl
Unexecuted instantiation: glib-unix.c:g_bit_storage_impl
Unexecuted instantiation: gspawn.c:g_bit_storage_impl
Unexecuted instantiation: giounix.c:g_bit_storage_impl
Unexecuted instantiation: gthread-posix.c:g_bit_storage_impl
Unexecuted instantiation: garcbox.c:g_bit_storage_impl
Unexecuted instantiation: garray.c:g_bit_storage_impl
Unexecuted instantiation: gbitlock.c:g_bit_storage_impl
Unexecuted instantiation: gbytes.c:g_bit_storage_impl
Unexecuted instantiation: gdate.c:g_bit_storage_impl
Unexecuted instantiation: gdir.c:g_bit_storage_impl
Unexecuted instantiation: ghostutils.c:g_bit_storage_impl
Unexecuted instantiation: glib-init.c:g_bit_storage_impl
Unexecuted instantiation: gmappedfile.c:g_bit_storage_impl
Unexecuted instantiation: gqsort.c:g_bit_storage_impl
Unexecuted instantiation: grand.c:g_bit_storage_impl
Unexecuted instantiation: grcbox.c:g_bit_storage_impl
Unexecuted instantiation: gshell.c:g_bit_storage_impl
Unexecuted instantiation: gscanner.c:g_bit_storage_impl
Unexecuted instantiation: gdataset.c:g_bit_storage_impl
Unexecuted instantiation: gmodule.c:g_bit_storage_impl
Unexecuted instantiation: gbase64.c:g_bit_storage_impl
435
436
/* Crashes the program. */
437
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50
438
#ifndef G_OS_WIN32
439
#  include <stdlib.h>
440
0
#  define g_abort() abort ()
441
#else
442
GLIB_AVAILABLE_IN_2_50
443
G_NORETURN void g_abort (void) G_ANALYZER_NORETURN;
444
#endif
445
#endif
446
447
/*
448
 * This macro is deprecated. This DllMain() is too complex. It is
449
 * recommended to write an explicit minimal DLlMain() that just saves
450
 * the handle to the DLL and then use that handle instead, for
451
 * instance passing it to
452
 * g_win32_get_package_installation_directory_of_module().
453
 *
454
 * On Windows, this macro defines a DllMain function that stores the
455
 * actual DLL name that the code being compiled will be included in.
456
 * STATIC should be empty or 'static'. DLL_NAME is the name of the
457
 * (pointer to the) char array where the DLL name will be stored. If
458
 * this is used, you must also include <windows.h>. If you need a more complex
459
 * DLL entry point function, you cannot use this.
460
 *
461
 * On non-Windows platforms, expands to nothing.
462
 */
463
464
#ifndef G_PLATFORM_WIN32
465
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) GLIB_DEPRECATED_MACRO_IN_2_26
466
#else
467
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)     \
468
static char *dll_name;              \
469
                  \
470
BOOL WINAPI               \
471
DllMain (HINSTANCE hinstDLL,            \
472
   DWORD     fdwReason,           \
473
   LPVOID    lpvReserved)           \
474
{                 \
475
  wchar_t wcbfr[1000];              \
476
  char *tem;                \
477
  switch (fdwReason)              \
478
    {                 \
479
    case DLL_PROCESS_ATTACH:            \
480
      GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \
481
      tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL);    \
482
      dll_name = g_path_get_basename (tem);       \
483
      g_free (tem);             \
484
      break;                \
485
    }                 \
486
                  \
487
  return TRUE;                \
488
} GLIB_DEPRECATED_MACRO_IN_2_26
489
#endif /* G_PLATFORM_WIN32 */
490
491
G_END_DECLS
492
493
#endif /* __G_UTILS_H__ */