Namespace

GLib – 2.0

GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on.

Version2.68
AuthorsGTK Development Team
LicenseGPL-2.1-or-later
Websitehttps://www.gtk.org
Sourcehttps://gitlab.gnome.org/GNOME/glib/

Build

C headersglib.h
pkg-config filesglib-2.0

Dependencies

GModule Portable API for dynamically loading modules
Browse documentation
GObject The base type system library
Browse documentation
GIO GObject Interfaces and Objects, Networking, IPC, and I/O
Browse documentation

Structs

Array

Contains the public fields of a GArray.

AsyncQueue

The GAsyncQueue struct is an opaque data structure which represents an asynchronous queue. It should only be accessed through the g_async_queue_* functions.

BookmarkFile

The GBookmarkFile structure contains only private data and should not be directly accessed.

ByteArray

Contains the public fields of a GByteArray.

Bytes

A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin.

Checksum

An opaque structure representing a checksumming operation. To create a new GChecksum, use g_checksum_new(). To free a GChecksum, use g_checksum_free().

Cond

The GCond struct is an opaque data structure that represents a condition. Threads can block on a GCond if they find a certain condition to be false. If other threads change the state of this condition they signal the GCond, and that causes the waiting threads to be woken up.

Data

The GData struct is an opaque data structure to represent a [Keyed Data List][glib-Keyed-Data-Lists]. It should only be accessed via the following functions.

Date

Represents a day between January 1, Year 1 and a few thousand years in the future. None of its members should be accessed directly.

DateTime

GDateTime is an opaque structure whose members cannot be accessed directly.

DebugKey

Associates a string with a bit flag. Used in g_parse_debug_string().

Dir

An opaque structure representing an opened directory.

Error

The GError structure contains information about an error that has occurred.

HashTable

The GHashTable struct is an opaque data structure to represent a [Hash Table][glib-Hash-Tables]. It should only be accessed via the following functions.

HashTableIter

A GHashTableIter structure represents an iterator that can be used to iterate over the elements of a GHashTable. GHashTableIter structures are typically allocated on the stack and then initialized with g_hash_table_iter_init().

Hmac

An opaque structure representing a HMAC operation. To create a new GHmac, use g_hmac_new(). To free a GHmac, use g_hmac_unref().

Hook

The GHook struct represents a single hook function in a GHookList.

HookList

The GHookList struct represents a list of hook functions.

IConv

The GIConv struct wraps an iconv() conversion descriptor. It contains private data and should only be accessed using the following functions.

IOChannel

A data structure representing an IO Channel. The fields should be considered private and should only be accessed with the following functions.

IOFuncs

A table of functions used to handle different types of GIOChannel in a generic way.

KeyFile

The GKeyFile struct contains only private data and should not be accessed directly.

List

The GList struct is used for each element in a doubly-linked list.

LogField

Structure representing a single field in a structured log entry. See g_log_structured() for details.

MainContext

The GMainContext struct is an opaque data type representing a set of sources to be handled in a main loop.

MainLoop

The GMainLoop struct is an opaque data type representing the main event loop of a GLib or GTK+ application.

MappedFile

The GMappedFile represents a file mapping created with g_mapped_file_new(). It has only private members and should not be accessed directly.

MarkupParseContext

A parse context is used to parse a stream of bytes that you expect to contain marked-up text.

MarkupParser

Any of the fields in GMarkupParser can be NULL, in which case they will be ignored. Except for the error function, any of these callbacks can set an error; in particular the G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and G_MARKUP_ERROR_INVALID_CONTENT errors are intended to be set from these callbacks. If you set an error from a callback, g_markup_parse_context_parse() will report that error back to its caller.

MatchInfo

A GMatchInfo is an opaque struct used to return information about matches.

MemVTable

A set of functions used to perform memory allocation. The same GMemVTable must be used for all allocations in the same program; a call to g_mem_set_vtable(), if it exists, should be prior to any use of GLib.

Node

The GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees].

Once

A GOnce struct controls a one-time initialization function. Any one-time initialization function must have its own unique GOnce struct.

OptionContext

A GOptionContext struct defines which options are accepted by the commandline option parser. The struct has only private fields and should not be directly accessed.

OptionEntry

A GOptionEntry struct defines a single option. To have an effect, they must be added to a GOptionGroup with g_option_context_add_main_entries() or g_option_group_add_entries().

OptionGroup

A GOptionGroup struct defines the options in a single group. The struct has only private fields and should not be directly accessed.

PatternSpec

A GPatternSpec struct is the ‘compiled’ form of a pattern. This structure is opaque and its fields cannot be accessed directly.

PollFD

Represents a file descriptor, which events to poll for, and which events occurred.

Private

The GPrivate struct is an opaque data structure to represent a thread-local data key. It is approximately equivalent to the pthread_setspecific()/pthread_getspecific() APIs on POSIX and to TlsSetValue()/TlsGetValue() on Windows.

PtrArray

Contains the public fields of a pointer array.

Queue

Contains the public fields of a [Queue][glib-Double-ended-Queues].

Rand

The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.

RecMutex

The GRecMutex struct is an opaque data structure to represent a recursive mutex. It is similar to a GMutex with the difference that it is possible to lock a GRecMutex multiple times in the same thread without deadlock. When doing so, care has to be taken to unlock the recursive mutex as often as it has been locked.

Regex

The g_regex_*() functions implement regular expression pattern matching using syntax and semantics similar to Perl regular expression.

RWLock

The GRWLock struct is an opaque data structure to represent a reader-writer lock. It is similar to a GMutex in that it allows multiple threads to coordinate access to a shared resource.

Scanner

The data structure representing a lexical scanner.

ScannerConfig

Specifies the GScanner parser configuration. Most settings can be changed during the parsing phase and will affect the lexical parsing of the next unpeeked token.

Sequence

The GSequence struct is an opaque data type representing a [sequence][glib-Sequences] data type.

SequenceIter

The GSequenceIter struct is an opaque data type representing an iterator pointing into a GSequence.

SList

The GSList struct is used for each element in the singly-linked list.

Source

The GSource struct is an opaque data type representing an event source.

SourceCallbackFuncs

The GSourceCallbackFuncs struct contains functions for managing callback objects.

SourceFuncs

The GSourceFuncs struct contains a table of functions used to handle event sources in a generic manner.

StatBuf

A type corresponding to the appropriate struct type for the stat() system call, depending on the platform and/or compiler being used.

String

The GString struct contains the public fields of a GString.

StringChunk

An opaque data structure representing String Chunks. It should only be accessed by using the following functions.

StrvBuilder

GStrvBuilder is a method of easily building dynamically sized NULL-terminated string arrays.

TestCase

An opaque structure representing a test case.

TestConfig
TestLogBuffer
TestLogMsg
TestSuite

An opaque structure representing a test suite.

Thread

The GThread struct represents a running thread. This struct is returned by g_thread_new() or g_thread_try_new(). You can obtain the GThread struct representing the current thread by calling g_thread_self().

ThreadPool

The GThreadPool struct represents a thread pool. It has three public read-only members, but the underlying struct is bigger, so you must not copy this struct.

Timer

Opaque datatype that records a start time.

TimeVal

Represents a precise time, with seconds and microseconds. Similar to the struct timeval returned by the gettimeofday() UNIX system call.

TimeZone

GTimeZone is an opaque structure whose members cannot be accessed directly.

TrashStack

Each piece of memory that is pushed onto the stack is cast to a GTrashStack*.

Tree

The GTree struct is an opaque data structure representing a [balanced binary tree][glib-Balanced-Binary-Trees]. It should be accessed only by using the following functions.

TreeNode

An opaque type which identifies a specific node in a GTree.

Uri

The GUri type and related functions can be used to parse URIs into their components, and build valid URIs from individual components.

UriParamsIter

Many URI schemes include one or more attribute/value pairs as part of the URI value. For example scheme://server/path?query=string&is=there has two attributes – query=string and is=there – in its query part.

Variant

GVariant is a variant datatype; it can contain one or more values along with information about the type of the values.

VariantBuilder

A utility type for constructing container-type GVariant instances.

VariantDict

GVariantDict is a mutable interface to GVariant dictionaries.

VariantIter

GVariantIter is an opaque data structure and can only be accessed using the following functions.

VariantType

This section introduces the GVariant type system. It is based, in large part, on the D-Bus type system, with two major changes and some minor lifting of restrictions. The D-Bus specification, therefore, provides a significant amount of information that is useful when working with GVariant.

Unions

DoubleIEEE754

The GFloatIEEE754 and GDoubleIEEE754 unions are used to access the sign, mantissa and exponent of IEEE floats and doubles. These unions are defined as appropriate for a given platform. IEEE floats and doubles are supported (used for storage) by at least Intel, PPC and Sparc.

FloatIEEE754

The GFloatIEEE754 and GDoubleIEEE754 unions are used to access the sign, mantissa and exponent of IEEE floats and doubles. These unions are defined as appropriate for a given platform. IEEE floats and doubles are supported (used for storage) by at least Intel, PPC and Sparc.

Mutex

The GMutex struct is an opaque data structure to represent a mutex (mutual exclusion). It can be used to protect data against shared access.

TokenValue

A union holding the value of the token.

Aliases

DateDay

Integer representing a day of the month; between 1 and 31.

G_DATE_BAD_DAY represents an invalid day of the month.

DateYear

Integer representing a year; #G_DATE_BAD_YEAR is the invalid value. The year must be 1 or higher; negative (BC) years are not allowed. The year is represented with four digits.

MainContextPusher

Opaque type. See g_main_context_pusher_new() for details.

MutexLocker

Opaque type. See g_mutex_locker_new() for details.

Pid

A type which is used to hold a process identification.

Quark

A GQuark is a non-zero integer which uniquely identifies a particular string. A GQuark value of zero is associated to NULL.

RecMutexLocker

Opaque type. See g_rec_mutex_locker_new() for details.

RefString

A typedef for a reference-counted string. A pointer to a GRefString can be treated like a standard char* array by all code, but can additionally have g_ref_string_*() methods called on it. g_ref_string_*() methods cannot be called on char* arrays not allocated using g_ref_string_new().

RWLockReaderLocker

Opaque type. See g_rw_lock_reader_locker_new() for details.

RWLockWriterLocker

Opaque type. See g_rw_lock_writer_locker_new() for details.

Strv

A typedef alias for gchar**. This is mostly useful when used together with g_auto().

Time

Simply a replacement for time_t. It has been deprecated since it is not equivalent to time_t on 64-bit platforms with a 64-bit time_t. Unrelated to GTimer.

TimeSpan

A value representing an interval of time, in microseconds.

Type

Enumerations

ChecksumType

The hashing algorithm to be used by GChecksum when performing the digest of some data.

DateDMY

This enumeration isn’t used in the API, but may be useful if you need to mark a number as a day, month, or year.

DateMonth

Enumeration representing a month; values are #G_DATE_JANUARY,

G_DATE_FEBRUARY, etc. #G_DATE_BAD_MONTH is the invalid value.

DateWeekday

Enumeration representing a day of the week; #G_DATE_MONDAY,

G_DATE_TUESDAY, etc. #G_DATE_BAD_WEEKDAY is an invalid weekday.

ErrorType

The possible errors, used in the v_error field of GTokenValue, when the token is a G_TOKEN_ERROR.

IOError

GIOError is only used by the deprecated functions g_io_channel_read(), g_io_channel_write(), and g_io_channel_seek().

IOStatus

Statuses returned by most of the GIOFuncs functions.

LogWriterOutput

Return values from GLogWriterFuncs to indicate whether the given log entry was successfully handled by the writer, or whether there was an error in handling it (and hence a fallback writer should be used).

NormalizeMode

Defines how a Unicode string is transformed in a canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. Unicode strings should generally be normalized before comparing them.

OnceStatus

The possible statuses of a one-time initialization function controlled by a GOnce struct.

OptionArg

The GOptionArg enum values determine which type of extra argument the options expect to find. If an option expects an extra argument, it can be specified in several ways; with a short option: -x arg, with a long option: --name arg or combined in a single argument: --name=arg.

SeekType

An enumeration specifying the base position for a g_io_channel_seek_position() operation.

SliceConfig
TestFileType

The type of file to return the filename for, when used with g_test_build_filename().

TestLogType
TestResult
TimeType

Disambiguates a given time in two ways.

TokenType

The possible types of token returned from each g_scanner_get_next_token() call.

TraverseType

Specifies the type of traversal performed by g_tree_traverse(), g_node_traverse() and g_node_find(). The different orders are illustrated here: - In order: A, B, C, D, E, F, G, H, I - Pre order: F, B, A, D, C, E, G, I, H - Post order: A, C, E, D, B, H, I, G, F - Level order: F, B, G, A, D, I, C, E, H

UnicodeBreakType

These are the possible line break classifications.

UnicodeScript

The GUnicodeScript enumeration identifies different writing systems. The values correspond to the names as defined in the Unicode standard. The enumeration has been added in GLib 2.14, and is interchangeable with PangoScript.

UnicodeType

These are the possible character classifications from the Unicode specification. See Unicode Character Database.

UserDirectory

These are logical ids for special directories which are defined depending on the platform used. You should use g_get_user_special_dir() to retrieve the full path associated to the logical id.

VariantClass

The range of possible top-level types of GVariant instances.

Bitfields

AsciiType
FileSetContentsFlags

Flags to pass to g_file_set_contents_full() to affect its safety and performance.

FileTest

A test to perform on a file using g_file_test().

FormatSizeFlags

Flags to modify the format of the string returned by g_format_size_full().

HookFlagMask

Flags used internally in the GHook implementation.

IOCondition

A bitwise combination representing a condition to watch for on an event source.

IOFlags

Specifies properties of a GIOChannel. Some of the flags can only be read with g_io_channel_get_flags(), but not changed with g_io_channel_set_flags().

KeyFileFlags

Flags which influence the parsing.

LogLevelFlags

Flags specifying the level of log messages.

MarkupCollectType

A mixed enumerated type and flags field. You must specify one type (string, strdup, boolean, tristate). Additionally, you may optionally bitwise OR the type with the flag G_MARKUP_COLLECT_OPTIONAL.

MarkupParseFlags

Flags that affect the behaviour of the parser.

OptionFlags

Flags which modify individual options.

RegexCompileFlags

Flags specifying compile-time options.

RegexMatchFlags

Flags specifying match-time options.

SpawnFlags

Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().

TestSubprocessFlags

Flags to pass to g_test_trap_subprocess() to control input and output.

TestTrapFlags

Test traps are guards around forked tests. These flags determine what traps to set.

TraverseFlags

Specifies which nodes are visited during several of the tree functions, including g_node_traverse() and g_node_find().

UriFlags

Flags that describe a URI.

UriHideFlags

Flags describing what parts of the URI to hide in g_uri_to_string_partial(). Note that G_URI_HIDE_PASSWORD and G_URI_HIDE_AUTH_PARAMS will only work if the GUri was parsed with the corresponding flags.

UriParamsFlags

Flags modifying the way parameters are handled by g_uri_parse_params() and GUriParamsIter.

Error Domains

BookmarkFileError

Error codes returned by bookmark file parsing.

ConvertError

Error codes returned by character set conversion routines.

FileError

Values corresponding to errno codes returned from file operations on UNIX. Unlike errno codes, GFileError values are available on all systems, even Windows. The exact meaning of each code depends on what sort of file operation you were performing; the UNIX documentation gives more details. The following error code descriptions come from the GNU C Library manual, and are under the copyright of that manual.

IOChannelError

Error codes returned by GIOChannel operations.

KeyFileError

Error codes returned by key file parsing.

MarkupError

Error codes returned by markup parsing.

NumberParserError

Error codes returned by functions converting a string to a number.

OptionError

Error codes returned by option parsing.

RegexError

Error codes returned by regular expressions functions.

ShellError

Error codes returned by shell functions.

SpawnError

Error codes returned by spawning processes.

ThreadError

Possible errors of thread related functions.

UriError

Error codes returned by GUri methods.

VariantParseError

Error codes returned by parsing text-format GVariants.

Callbacks

ChildWatchFunc

Prototype of a GChildWatchSource callback, called when a child process has exited. To interpret status, see the documentation for g_spawn_check_exit_status().

ClearHandleFunc

Specifies the type of function passed to g_clear_handle_id(). The implementation is expected to free the resource identified by handle_id; for instance, if handle_id is a GSource ID, g_source_remove() can be used.

CompareDataFunc

Specifies the type of a comparison function used to compare two values. The function should return a negative integer if the first value comes before the second, 0 if they are equal, or a positive integer if the first value comes after the second.

CompareFunc

Specifies the type of a comparison function used to compare two values. The function should return a negative integer if the first value comes before the second, 0 if they are equal, or a positive integer if the first value comes after the second.

CopyFunc

A function of this signature is used to copy the node data when doing a deep-copy of a tree.

DataForeachFunc

Specifies the type of function passed to g_dataset_foreach(). It is called with each GQuark id and associated data element, together with the user_data parameter supplied to g_dataset_foreach().

DestroyNotify

Specifies the type of function which is called when a data element is destroyed. It is passed the pointer to the data element and should free any memory and resources allocated for it.

DuplicateFunc

The type of functions that are used to ‘duplicate’ an object. What this means depends on the context, it could just be incrementing the reference count, if data is a ref-counted object.

EqualFunc

Specifies the type of a function used to test two values for equality. The function should return TRUE if both values are equal and FALSE otherwise.

ErrorClearFunc

Specifies the type of function which is called when an extended error instance is freed. It is passed the error pointer about to be freed, and should free the error’s private data fields.

ErrorCopyFunc

Specifies the type of function which is called when an extended error instance is copied. It is passed the pointer to the destination error and source error, and should copy only the fields of the private data from src_error to dest_error.

ErrorInitFunc

Specifies the type of function which is called just after an extended error instance is created and its fields filled. It should only initialize the fields in the private data, which can be received with the generated *_get_private() function.

FreeFunc

Declares a type of function which takes an arbitrary data pointer argument and has no return value. It is not currently used in GLib or GTK+.

Func

Specifies the type of functions passed to g_list_foreach() and g_slist_foreach().

HashFunc

Specifies the type of the hash function which is passed to g_hash_table_new() when a GHashTable is created.

HFunc

Specifies the type of the function passed to g_hash_table_foreach(). It is called with each key/value pair, together with the user_data parameter which is passed to g_hash_table_foreach().

HookCheckFunc

Defines the type of a hook function that can be invoked by g_hook_list_invoke_check().

HookCheckMarshaller

Defines the type of function used by g_hook_list_marshal_check().

HookCompareFunc

Defines the type of function used to compare GHook elements in g_hook_insert_sorted().

HookFinalizeFunc

Defines the type of function to be called when a hook in a list of hooks gets finalized.

HookFindFunc

Defines the type of the function passed to g_hook_find().

HookFunc

Defines the type of a hook function that can be invoked by g_hook_list_invoke().

HookMarshaller

Defines the type of function used by g_hook_list_marshal().

HRFunc

Specifies the type of the function passed to g_hash_table_foreach_remove(). It is called with each key/value pair, together with the user_data parameter passed to g_hash_table_foreach_remove(). It should return TRUE if the key/value pair should be removed from the GHashTable.

IOFunc

Specifies the type of function passed to g_io_add_watch() or g_io_add_watch_full(), which is called when the requested condition on a GIOChannel is satisfied.

LogFunc

Specifies the prototype of log handler functions.

LogWriterFunc

Writer function for log entries. A log entry is a collection of one or more GLogFields, using the standard field names from journal specification. See g_log_structured() for more information.

NodeForeachFunc

Specifies the type of function passed to g_node_children_foreach(). The function is called with each child node, together with the user data passed to g_node_children_foreach().

NodeTraverseFunc

Specifies the type of function passed to g_node_traverse(). The function is called with each of the nodes visited, together with the user data passed to g_node_traverse(). If the function returns TRUE, then the traversal is stopped.

OptionArgFunc

The type of function to be passed as callback for G_OPTION_ARG_CALLBACK options.

OptionErrorFunc

The type of function to be used as callback when a parse error occurs.

OptionParseFunc

The type of function that can be called before and after parsing.

PollFunc

Specifies the type of function passed to g_main_context_set_poll_func(). The semantics of the function should match those of the poll() system call.

PrintFunc

Specifies the type of the print handler functions. These are called with the complete formatted string to output.

RegexEvalCallback

Specifies the type of the function passed to g_regex_replace_eval(). It is called for each occurrence of the pattern in the string passed to g_regex_replace_eval(), and it should append the replacement to result.

ScannerMsgFunc

Specifies the type of the message handler function.

SequenceIterCompareFunc

A GSequenceIterCompareFunc is a function used to compare iterators. It must return zero if the iterators compare equal, a negative value if a comes before b, and a positive value if b comes before a.

SourceDisposeFunc

Dispose function for source. See g_source_set_dispose_function() for details.

SourceDummyMarshal

This is just a placeholder for GClosureMarshal, which cannot be used here for dependency reasons.

SourceFunc

Specifies the type of function passed to g_timeout_add(), g_timeout_add_full(), g_idle_add(), and g_idle_add_full().

SpawnChildSetupFunc

Specifies the type of the setup function passed to g_spawn_async(), g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very limited ways, be used to affect the child’s execution.

TestDataFunc

The type used for test case functions that take an extra pointer argument.

TestFixtureFunc

The type used for functions that operate on test fixtures. This is used for the fixture setup and teardown functions as well as for the testcases themselves.

TestFunc

The type used for test case functions.

TestLogFatalFunc

Specifies the prototype of fatal log handler functions.

ThreadFunc

Specifies the type of the func functions passed to g_thread_new() or g_thread_try_new().

TranslateFunc

The type of functions which are used to translate user-visible strings, for output.

TraverseFunc

Specifies the type of function passed to g_tree_traverse(). It is passed the key and value of each node, together with the user_data parameter passed to g_tree_traverse(). If the function returns TRUE, the traversal is stopped.

TraverseNodeFunc

Specifies the type of function passed to g_tree_foreach_node(). It is passed each node, together with the user_data parameter passed to g_tree_foreach_node(). If the function returns TRUE, the traversal is stopped.

UnixFDSourceFunc

The type of functions to be called when a UNIX fd watch source triggers.

VoidFunc

Declares a type of function which takes no arguments and has no return value. It is used to specify the type function passed to g_atexit().

Functions

access

A wrapper for the POSIX access() function. This function is used to test a pathname for one or several of read, write or execute permissions, or just existence.

ascii_digit_value

Determines the numeric value of a character as a decimal digit. Differs from g_unichar_digit_value() because it takes a char, so there’s no worry about sign extension if characters are signed.

ascii_dtostr

Converts a #gdouble to a string, using the ‘.’ as decimal point.

ascii_formatd

Converts a #gdouble to a string, using the ‘.’ as decimal point. To format the number you pass in a printf()-style format string. Allowed conversion specifiers are ‘e’, ‘E’, ‘f’, ‘F’, ‘g’ and ‘G’.

ascii_strcasecmp

Compare two strings, ignoring the case of ASCII characters.

ascii_strdown

Converts all upper case ASCII letters to lower case ASCII letters.

ascii_string_to_signed

A convenience function for converting a string to a signed number.

ascii_string_to_unsigned

A convenience function for converting a string to an unsigned number.

ascii_strncasecmp

Compare s1 and s2, ignoring the case of ASCII characters and any characters after the first n in each string.

ascii_strtod

Converts a string to a #gdouble value.

ascii_strtoll

Converts a string to a #gint64 value. This function behaves like the standard strtoll() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe.

ascii_strtoull

Converts a string to a #guint64 value. This function behaves like the standard strtoull() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe.

ascii_strup

Converts all lower case ASCII letters to upper case ASCII letters.

ascii_tolower

Convert a character to ASCII lower case.

ascii_toupper

Convert a character to ASCII upper case.

ascii_xdigit_value

Determines the numeric value of a character as a hexadecimal digit. Differs from g_unichar_xdigit_value() because it takes a char, so there’s no worry about sign extension if characters are signed.

assert_warning
assertion_message
assertion_message_cmpnum
assertion_message_cmpstr
assertion_message_cmpstrv
assertion_message_error
assertion_message_expr

Internal function used to print messages from the public g_assert() and g_assert_not_reached() macros.

atexit

Specifies a function to be called at normal program termination.

atomic_int_add

Atomically adds val to the value of atomic.

atomic_int_and

Performs an atomic bitwise ‘and’ of the value of atomic and val, storing the result back in atomic.

atomic_int_compare_and_exchange

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.

atomic_int_dec_and_test

Decrements the value of atomic by 1.

atomic_int_exchange_and_add

This function existed before g_atomic_int_add() returned the prior value of the integer (which it now does). It is retained only for compatibility reasons. Don’t use this function in new code.

atomic_int_get

Gets the current value of atomic.

atomic_int_inc

Increments the value of atomic by 1.

atomic_int_or

Performs an atomic bitwise ‘or’ of the value of atomic and val, storing the result back in atomic.

atomic_int_set

Sets the value of atomic to newval.

atomic_int_xor

Performs an atomic bitwise ‘xor’ of the value of atomic and val, storing the result back in atomic.

atomic_pointer_add

Atomically adds val to the value of atomic.

atomic_pointer_and

Performs an atomic bitwise ‘and’ of the value of atomic and val, storing the result back in atomic.

atomic_pointer_compare_and_exchange

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.

atomic_pointer_get

Gets the current value of atomic.

atomic_pointer_or

Performs an atomic bitwise ‘or’ of the value of atomic and val, storing the result back in atomic.

atomic_pointer_set

Sets the value of atomic to newval.

atomic_pointer_xor

Performs an atomic bitwise ‘xor’ of the value of atomic and val, storing the result back in atomic.

atomic_rc_box_acquire

Atomically acquires a reference on the data pointed by mem_block.

atomic_rc_box_alloc

Allocates block_size bytes of memory, and adds atomic reference counting semantics to it.

atomic_rc_box_alloc0

Allocates block_size bytes of memory, and adds atomic reference counting semantics to it.

atomic_rc_box_dup

Allocates a new block of data with atomic reference counting semantics, and copies block_size bytes of mem_block into it.

atomic_rc_box_get_size

Retrieves the size of the reference counted data pointed by mem_block.

atomic_rc_box_release

Atomically releases a reference on the data pointed by mem_block.

atomic_rc_box_release_full

Atomically releases a reference on the data pointed by mem_block.

atomic_ref_count_compare

Atomically compares the current value of arc with val.

atomic_ref_count_dec

Atomically decreases the reference count.

atomic_ref_count_inc

Atomically increases the reference count.

atomic_ref_count_init

Initializes a reference count variable.

base64_decode

Decode a sequence of Base-64 encoded text into binary data. Note that the returned binary data is not necessarily zero-terminated, so it should not be used as a character string.

base64_decode_inplace

Decode a sequence of Base-64 encoded text into binary data by overwriting the input data.

base64_decode_step

Incrementally decode a sequence of binary data from its Base-64 stringified representation. By calling this function multiple times you can convert data in chunks to avoid having to have the full encoded data in memory.

base64_encode

Encode a sequence of binary data into its Base-64 stringified representation.

base64_encode_close

Flush the status from a sequence of calls to g_base64_encode_step().

base64_encode_step

Incrementally encode a sequence of binary data into its Base-64 stringified representation. By calling this function multiple times you can convert data in chunks to avoid having to have the full encoded data in memory.

basename

Gets the name of the file without any leading directory components. It returns a pointer into the given file name string.

bit_lock

Sets the indicated lock_bit in address. If the bit is already set, this call will block until g_bit_unlock() unsets the corresponding bit.

bit_nth_lsf

Find the position of the first bit set in mask, searching from (but not including) nth_bit upwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the 0th bit, set nth_bit to -1.

bit_nth_msf

Find the position of the first bit set in mask, searching from (but not including) nth_bit downwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the last bit, set nth_bit to -1 or GLIB_SIZEOF_LONG * 8.

bit_storage

Gets the number of bits used to hold number, e.g. if number is 4, 3 bits are needed.

bit_trylock

Sets the indicated lock_bit in address, returning TRUE if successful. If the bit is already set, returns FALSE immediately.

bit_unlock

Clears the indicated lock_bit in address. If another thread is currently blocked in g_bit_lock() on this same bit then it will be woken up.

build_filename

Creates a filename from a series of elements using the correct separator for filenames.

build_filename_valist

Behaves exactly like g_build_filename(), but takes the path elements as a va_list. This function is mainly meant for language bindings.

build_filenamev

Behaves exactly like g_build_filename(), but takes the path elements as a string array, instead of varargs. This function is mainly meant for language bindings.

build_path

Creates a path from a series of elements using separator as the separator between elements. At the boundary between two elements, any trailing occurrences of separator in the first element, or leading occurrences of separator in the second element are removed and exactly one copy of the separator is inserted.

build_pathv

Behaves exactly like g_build_path(), but takes the path elements as a string array, instead of varargs. This function is mainly meant for language bindings.

canonicalize_filename

Gets the canonical file name from filename. All triple slashes are turned into single slashes, and all .. and .s resolved against relative_to.

chdir

A wrapper for the POSIX chdir() function. The function changes the current directory of the process to path.

check_version

Checks that the GLib library in use is compatible with the given version. Generally you would pass in the constants

GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION

as the three arguments to this function; that produces a check that the library in use is compatible with the version of GLib the application or module was compiled against.

child_watch_add

Sets a function to be called when the child indicated by pid exits, at a default priority, #G_PRIORITY_DEFAULT.

child_watch_add_full

Sets a function to be called when the child indicated by pid exits, at the priority priority.

child_watch_source_new

Creates a new child_watch source.

clear_error

If err or err is NULL, does nothing. Otherwise, calls g_error_free() on err and sets *err to NULL.

clear_handle_id

Clears a numeric handler, such as a GSource ID.

clear_list

Clears a pointer to a GList, freeing it and, optionally, freeing its elements using destroy.

clear_pointer

Clears a reference to a variable.

clear_slist

Clears a pointer to a GSList, freeing it and, optionally, freeing its elements using destroy.

close

This wraps the close() call; in case of error, %errno will be preserved, but the error will also be stored as a GError in error.

compute_checksum_for_bytes

Computes the checksum for a binary data. This is a convenience wrapper for g_checksum_new(), g_checksum_get_string() and g_checksum_free().

compute_checksum_for_data

Computes the checksum for a binary data of length. This is a convenience wrapper for g_checksum_new(), g_checksum_get_string() and g_checksum_free().

compute_checksum_for_string

Computes the checksum of a string.

compute_hmac_for_bytes

Computes the HMAC for a binary data. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref().

compute_hmac_for_data

Computes the HMAC for a binary data of length. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref().

compute_hmac_for_string

Computes the HMAC for a string.

convert

Converts a string from one character set to another.

convert_error_quark
convert_with_fallback

Converts a string from one character set to another, possibly including fallback sequences for characters not representable in the output. Note that it is not guaranteed that the specification for the fallback sequences in fallback will be honored. Some systems may do an approximate conversion from from_codeset to to_codeset in their iconv() functions, in which case GLib will simply return that approximate conversion.

convert_with_iconv

Converts a string from one character set to another.

datalist_clear

Frees all the data elements of the datalist. The data elements’ destroy functions are called if they have been set.

datalist_foreach

Calls the given function for each data element of the datalist. The function is called with each data element’s GQuark id and data, together with the given user_data parameter. Note that this function is NOT thread-safe. So unless datalist can be protected from any modifications during invocation of this function, it should not be called.

datalist_get_data

Gets a data element, using its string identifier. This is slower than g_datalist_id_get_data() because it compares strings.

datalist_get_flags

Gets flags values packed in together with the datalist. See g_datalist_set_flags().

datalist_id_dup_data

This is a variant of g_datalist_id_get_data() which returns a ‘duplicate’ of the value. dup_func defines the meaning of ‘duplicate’ in this context, it could e.g. take a reference on a ref-counted object.

datalist_id_get_data

Retrieves the data element corresponding to key_id.

datalist_id_remove_no_notify

Removes an element, without calling its destroy notification function.

datalist_id_replace_data

Compares the member that is associated with key_id in datalist to oldval, and if they are the same, replace oldval with newval.

datalist_id_set_data_full

Sets the data corresponding to the given GQuark id, and the function to be called when the element is removed from the datalist. Any previous data with the same key is removed, and its destroy function is called.

datalist_init

Resets the datalist to NULL. It does not free any memory or call any destroy functions.

datalist_set_flags

Turns on flag values for a data list. This function is used to keep a small number of boolean flags in an object with a data list without using any additional space. It is not generally useful except in circumstances where space is very tight. (It is used in the base GObject type, for example.)

datalist_unset_flags

Turns off flag values for a data list. See g_datalist_unset_flags()

dataset_destroy

Destroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements.

dataset_foreach

Calls the given function for each data element which is associated with the given location. Note that this function is NOT thread-safe. So unless dataset_location can be protected from any modifications during invocation of this function, it should not be called.

dataset_id_get_data

Gets the data element corresponding to a GQuark.

dataset_id_remove_no_notify

Removes an element, without calling its destroy notification function.

dataset_id_set_data_full

Sets the data element associated with the given GQuark id, and also the function to call when the data element is destroyed. Any previous data with the same key is removed, and its destroy function is called.

dcgettext

This is a variant of g_dgettext() that allows specifying a locale category instead of always using LC_MESSAGES. See g_dgettext() for more information about how this functions differs from calling dcgettext() directly.

dgettext

This function is a wrapper of dgettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale.

direct_equal

Compares two #gpointer arguments and returns TRUE if they are equal. It can be passed to g_hash_table_new() as the key_equal_func parameter, when using opaque pointers compared by pointer value as keys in a GHashTable.

direct_hash

Converts a gpointer to a hash value. It can be passed to g_hash_table_new() as the hash_func parameter, when using opaque pointers compared by pointer value as keys in a GHashTable.

dngettext

This function is a wrapper of dngettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale.

double_equal

Compares the two #gdouble values being pointed to and returns TRUE if they are equal. It can be passed to g_hash_table_new() as the key_equal_func parameter, when using non-NULL pointers to doubles as keys in a GHashTable.

double_hash

Converts a pointer to a #gdouble to a hash value. It can be passed to g_hash_table_new() as the hash_func parameter, It can be passed to g_hash_table_new() as the hash_func parameter, when using non-NULL pointers to doubles as keys in a GHashTable.

dpgettext

This function is a variant of g_dgettext() which supports a disambiguating message context. GNU gettext uses the ‘\004’ character to separate the message context and message id in msgctxtid. If 0 is passed as msgidoffset, this function will fall back to trying to use the deprecated convention of using “|” as a separation character.

dpgettext2

This function is a variant of g_dgettext() which supports a disambiguating message context. GNU gettext uses the ‘\004’ character to separate the message context and message id in msgctxtid.

environ_getenv

Returns the value of the environment variable variable in the provided list envp.

environ_setenv

Sets the environment variable variable in the provided list envp to value.

environ_unsetenv

Removes the environment variable variable from the provided environment envp.

file_error_from_errno

Gets a GFileError constant based on the passed-in err_no. For example, if you pass in EEXIST this function returns

G_FILE_ERROR_EXIST. Unlike errno values, you can portably

assume that all GFileError values will exist.

file_error_quark
file_get_contents

Reads an entire file into allocated memory, with good error checking.

file_open_tmp

Opens a file for writing in the preferred directory for temporary files (as returned by g_get_tmp_dir()).

file_read_link

Reads the contents of the symbolic link filename like the POSIX readlink() function. The returned string is in the encoding used for filenames. Use g_filename_to_utf8() to convert it to UTF-8.

file_set_contents

Writes all of contents to a file named filename. This is a convenience wrapper around calling g_file_set_contents_full() with flags set to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and mode set to 0666.

file_set_contents_full

Writes all of contents to a file named filename, with good error checking. If a file called filename already exists it will be overwritten.

file_test

Returns TRUE if any of the tests in the bitfield test are TRUE. For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return TRUE if the file exists; the check whether it’s a directory doesn’t matter since the existence test is TRUE. With the current set of available tests, there’s no point passing in more than one test at a time.

filename_display_basename

Returns the display basename for the particular filename, guaranteed to be valid UTF-8. The display name might not be identical to the filename, for instance there might be problems converting it to UTF-8, and some files can be translated in the display.

filename_display_name

Converts a filename into a valid UTF-8 string. The conversion is not necessarily reversible, so you should keep the original around and use the return value of this function only for display purposes. Unlike g_filename_to_utf8(), the result is guaranteed to be non-NULL even if the filename actually isn’t in the GLib file name encoding.

filename_from_uri

Converts an escaped ASCII-encoded URI to a local filename in the encoding used for filenames.

filename_from_utf8

Converts a string from UTF-8 to the encoding GLib uses for filenames. Note that on Windows GLib uses UTF-8 for filenames; on other platforms, this function indirectly depends on the [current locale][setlocale].

filename_to_uri

Converts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.

filename_to_utf8

Converts a string which is in the encoding used by GLib for filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8 for filenames; on other platforms, this function indirectly depends on the [current locale][setlocale].

find_program_in_path

Locates the first executable named program in the user’s path, in the same way that execvp() would locate it. Returns an allocated string with the absolute path name, or NULL if the program is not found in the path. If program is already an absolute path, returns a copy of program if program exists and is executable, and NULL otherwise.

On Windows, if program does not have a file type suffix, tries with the suffixes .exe, .cmd, .bat and .com, and the suffixes in the PATHEXT environment variable.

format_size

Formats a size (for example the size of a file) into a human readable string. Sizes are rounded to the nearest size prefix (kB, MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size 3292528 bytes will be converted into the string “3.2 MB”. The returned string is UTF-8, and may use a non-breaking space to separate the number and units, to ensure they aren’t separated when line wrapped.

format_size_for_display

Formats a size (for example the size of a file) into a human readable string. Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size 3292528 bytes will be converted into the string “3.1 MB”.

format_size_full

Formats a size.

fprintf

An implementation of the standard fprintf() function which supports positional parameters, as specified in the Single Unix Specification.

free

Frees the memory pointed to by mem.

get_application_name

Gets a human-readable name for the application, as set by g_set_application_name(). This name should be localized if possible, and is intended for display to the user. Contrast with g_get_prgname(), which gets a non-localized name. If g_set_application_name() has not been called, returns the result of g_get_prgname() (which may be NULL if g_set_prgname() has also not been called).

get_charset

Obtains the character set for the [current locale][setlocale]; you might use this character set as an argument to g_convert(), to convert from the current locale’s encoding to some other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8() are nice shortcuts, though.)

get_codeset

Gets the character set for the current locale.

get_console_charset

Obtains the character set used by the console attached to the process, which is suitable for printing output to the terminal.

get_current_dir

Gets the current directory.

get_current_time

Equivalent to the UNIX gettimeofday() function, but portable.

get_environ

Gets the list of environment variables for the current process.

get_filename_charsets

Determines the preferred character sets used for filenames. The first character set from the charsets is the filename encoding, the subsequent character sets are used when trying to generate a displayable representation of a filename, see g_filename_display_name().

get_home_dir

Gets the current user’s home directory.

get_host_name

Return a name for the machine.

get_language_names

Computes a list of applicable locale names, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale “C”.

get_language_names_with_category

Computes a list of applicable locale names with a locale category name, which can be used to construct the fallback locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale “C”.

get_locale_variants

Returns a list of derived variants of locale, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable. This function handles territory, charset and extra locale modifiers. See setlocale(3) for information about locales and their format.

get_monotonic_time

Queries the system monotonic time.

get_num_processors

Determine the approximate number of threads that the system will schedule simultaneously for this process. This is intended to be used as a parameter to g_thread_pool_new() for CPU bound tasks and similar cases.

get_os_info

Get information about the operating system.

get_prgname

Gets the name of the program. This name should not be localized, in contrast to g_get_application_name().

get_real_name

Gets the real name of the user. This usually comes from the user’s entry in the passwd file. The encoding of the returned string is system-defined. (On Windows, it is, however, always UTF-8.) If the real user name cannot be determined, the string “Unknown” is returned.

get_real_time

Queries the system wall-clock time.

get_system_config_dirs

Returns an ordered list of base directories in which to access system-wide configuration information.

get_system_data_dirs

Returns an ordered list of base directories in which to access system-wide application data.

get_tmp_dir

Gets the directory to use for temporary files.

get_user_cache_dir

Returns a base directory in which to store non-essential, cached data specific to particular user.

get_user_config_dir

Returns a base directory in which to store user-specific application configuration information such as user preferences and settings.

get_user_data_dir

Returns a base directory in which to access application data such as icons that is customized for a particular user.

get_user_name

Gets the user name of the current user. The encoding of the returned string is system-defined. On UNIX, it might be the preferred file name encoding, or something else, and there is no guarantee that it is even consistent on a machine. On Windows, it is always UTF-8.

get_user_runtime_dir

Returns a directory that is unique to the current user on the local system.

get_user_special_dir

Returns the full path of a special directory using its logical id.

getenv

Returns the value of an environment variable.

hostname_is_ascii_encoded

Tests if hostname contains segments with an ASCII-compatible encoding of an Internationalized Domain Name. If this returns TRUE, you should decode the hostname with g_hostname_to_unicode() before displaying it to the user.

hostname_is_ip_address

Tests if hostname is the string form of an IPv4 or IPv6 address. (Eg, “192.168.0.1”.)

hostname_is_non_ascii

Tests if hostname contains Unicode characters. If this returns TRUE, you need to encode the hostname with g_hostname_to_ascii() before using it in non-IDN-aware contexts.

hostname_to_ascii

Converts hostname to its canonical ASCII form; an ASCII-only string containing no uppercase letters and not ending with a trailing dot.

hostname_to_unicode

Converts hostname to its canonical presentation form; a UTF-8 string in Unicode normalization form C, containing no uppercase letters, no forbidden characters, and no ASCII-encoded segments, and not ending with a trailing dot.

iconv

Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.

idle_add

Adds a function to be called whenever there are no higher priority events pending to the default main loop. The function is given the default idle priority, #G_PRIORITY_DEFAULT_IDLE. If the function returns FALSE it is automatically removed from the list of event sources and will not be called again.

idle_add_full

Adds a function to be called whenever there are no higher priority events pending. If the function returns FALSE it is automatically removed from the list of event sources and will not be called again.

idle_remove_by_data

Removes the idle function with the given data.

idle_source_new

Creates a new idle source.

int64_equal

Compares the two #gint64 values being pointed to and returns TRUE if they are equal. It can be passed to g_hash_table_new() as the key_equal_func parameter, when using non-NULL pointers to 64-bit integers as keys in a GHashTable.

int64_hash

Converts a pointer to a #gint64 to a hash value.

int_equal

Compares the two #gint values being pointed to and returns TRUE if they are equal. It can be passed to g_hash_table_new() as the key_equal_func parameter, when using non-NULL pointers to integers as keys in a GHashTable.

int_hash

Converts a pointer to a #gint to a hash value. It can be passed to g_hash_table_new() as the hash_func parameter, when using non-NULL pointers to integer values as keys in a GHashTable.

intern_static_string

Returns a canonical representation for string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). g_intern_static_string() does not copy the string, therefore string must not be freed or modified.

intern_string

Returns a canonical representation for string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp().

io_add_watch

Adds the GIOChannel into the default main loop context with the default priority.

io_add_watch_full

Adds the GIOChannel into the default main loop context with the given priority.

io_create_watch

Creates a GSource that’s dispatched when condition is met for the given channel. For example, if condition is #G_IO_IN, the source will be dispatched when there’s data available for reading.

listenv

Gets the names of all variables set in the environment.

locale_from_utf8

Converts a string from UTF-8 to the encoding used for strings by the C runtime (usually the same as that used by the operating system) in the [current locale][setlocale]. On Windows this means the system codepage.

locale_to_utf8

Converts a string which is in the encoding used for strings by the C runtime (usually the same as that used by the operating system) in the [current locale][setlocale] into a UTF-8 string.

log

Logs an error or debugging message.

log_default_handler

The default log handler set up by GLib; g_log_set_default_handler() allows to install an alternate default log handler. This is used if no log handler has been set for the particular log domain and log level combination. It outputs the message to stderr or stdout and if the log level is fatal it calls G_BREAKPOINT(). It automatically prints a new-line character after the message, so one does not need to be manually included in message.

log_remove_handler

Removes the log handler.

log_set_always_fatal

Sets the message levels which are always fatal, in any log domain. When a message with any of these levels is logged the program terminates. You can only set the levels defined by GLib to be fatal. G_LOG_LEVEL_ERROR is always fatal.

log_set_default_handler

Installs a default log handler which is used if no log handler has been set for the particular log domain and log level combination. By default, GLib uses g_log_default_handler() as default log handler.

log_set_fatal_mask

Sets the log levels which are fatal in the given domain. G_LOG_LEVEL_ERROR is always fatal.

log_set_handler

Sets the log handler for a domain and a set of log levels. To handle fatal and recursive messages the log_levels parameter must be combined with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION bit flags.

log_set_handler_full

Like g_log_set_handler(), but takes a destroy notify for the user_data.

log_set_writer_func

Set a writer function which will be called to format and write out each log message. Each program should set a writer function, or the default writer (g_log_writer_default()) will be used.

log_structured

Log a message with structured data. The message will be passed through to the log writer set by the application using g_log_set_writer_func(). If the message is fatal (i.e. its log level is G_LOG_LEVEL_ERROR), the program will be aborted by calling G_BREAKPOINT() at the end of this function. If the log writer returns G_LOG_WRITER_UNHANDLED (failure), no other fallback writers will be tried. See the documentation for GLogWriterFunc for information on chaining writers.

log_structured_array

Log a message with structured data. The message will be passed through to the log writer set by the application using g_log_set_writer_func(). If the message is fatal (i.e. its log level is G_LOG_LEVEL_ERROR), the program will be aborted at the end of this function.

log_structured_standard
log_variant

Log a message with structured data, accepting the data within a GVariant. This version is especially useful for use in other languages, via introspection.

log_writer_default

Format a structured log message and output it to the default log destination for the platform. On Linux, this is typically the systemd journal, falling back to stdout or stderr if running from the terminal or if output is being redirected to a file.

log_writer_default_set_use_stderr

Configure whether the built-in log functions (g_log_default_handler() for the old-style API, and both g_log_writer_default() and g_log_writer_standard_streams() for the structured API) will output all log messages to stderr.

log_writer_default_would_drop

Check whether g_log_writer_default() and g_log_default_handler() would ignore a message with the given domain and level.

log_writer_format_fields

Format a structured log message as a string suitable for outputting to the terminal (or elsewhere). This will include the values of all fields it knows how to interpret, which includes MESSAGE and GLIB_DOMAIN (see the documentation for g_log_structured()). It does not include values from unknown fields.

log_writer_is_journald

Check whether the given output_fd file descriptor is a connection to the systemd journal, or something else (like a log file or stdout or stderr).

log_writer_journald

Format a structured log message and send it to the systemd journal as a set of key–value pairs. All fields are sent to the journal, but if a field has length zero (indicating program-specific data) then only its key will be sent.

log_writer_standard_streams

Format a structured log message and print it to either stdout or stderr, depending on its log level. G_LOG_LEVEL_INFO and G_LOG_LEVEL_DEBUG messages are sent to stdout, or to stderr if requested by g_log_writer_default_set_use_stderr(); all other log levels are sent to stderr. Only fields which are understood by this function are included in the formatted string which is printed.

log_writer_supports_color

Check whether the given output_fd file descriptor supports ANSI color escape sequences. If so, they can safely be used when formatting log messages.

logv

Logs an error or debugging message.

main_current_source

Returns the currently firing source for this thread.

main_depth

Returns the depth of the stack of calls to g_main_context_dispatch() on any GMainContext in the current thread. That is, when called from the toplevel, it gives 0. When called from within a callback from g_main_context_iteration() (or g_main_loop_run(), etc.) it returns 1. When called from within a callback to a recursive call to g_main_context_iteration(), it returns 2. And so forth.

malloc

Allocates n_bytes bytes of memory. If n_bytes is 0 it returns NULL.

malloc0

Allocates n_bytes bytes of memory, initialized to 0’s. If n_bytes is 0 it returns NULL.

malloc0_n

This function is similar to g_malloc0(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

malloc_n

This function is similar to g_malloc(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

markup_collect_attributes

Collects the attributes of the element from the data passed to the GMarkupParser start_element function, dealing with common error conditions and supporting boolean values.

markup_error_quark
markup_escape_text

Escapes text so that the markup parser will parse it verbatim. Less than, greater than, ampersand, etc. are replaced with the corresponding entities. This function would typically be used when writing out a file to be parsed with the markup parser.

markup_printf_escaped

Formats arguments according to format, escaping all string and character arguments in the fashion of g_markup_escape_text(). This is useful when you want to insert literal strings into XML-style markup output, without having to worry that the strings might themselves contain markup.

markup_vprintf_escaped

Formats the data in args according to format, escaping all string and character arguments in the fashion of g_markup_escape_text(). See g_markup_printf_escaped().

mem_is_system_malloc

Checks whether the allocator used by g_malloc() is the system’s malloc implementation. If it returns TRUE memory allocated with malloc() can be used interchangeably with memory allocated using g_malloc(). This function is useful for avoiding an extra copy of allocated memory returned by a non-GLib-based API.

mem_profile

GLib used to support some tools for memory profiling, but this no longer works. There are many other useful tools for memory profiling these days which can be used instead.

mem_set_vtable

This function used to let you override the memory allocation function. However, its use was incompatible with the use of global constructors in GLib and GIO, because those use the GLib allocators before main is reached. Therefore this function is now deprecated and is just a stub.

memdup

Allocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is NULL it returns NULL.

memdup2

Allocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is NULL it returns NULL.

mkdir_with_parents

Create a directory if it doesn’t already exist. Create intermediate parent directories as needed, too.

mkdtemp

Creates a temporary directory. See the mkdtemp() documentation on most UNIX-like systems.

mkdtemp_full

Creates a temporary directory. See the mkdtemp() documentation on most UNIX-like systems.

mkstemp

Opens a temporary file. See the mkstemp() documentation on most UNIX-like systems.

mkstemp_full

Opens a temporary file. See the mkstemp() documentation on most UNIX-like systems.

nullify_pointer

Set the pointer at the specified location to NULL.

number_parser_error_quark
on_error_query

Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed. This function is intended to be used for debugging use only. The following example shows how it can be used together with the g_log() functions.

on_error_stack_trace

Invokes gdb, which attaches to the current process and shows a stack trace. Called by g_on_error_query() when the “[S]tack trace” option is selected. You can get the current process’s program name with g_get_prgname(), assuming that you have called gtk_init() or gdk_init().

option_error_quark
parse_debug_string

Parses a string containing debugging options into a %guint containing bit flags. This is used within GDK and GTK+ to parse the debug options passed on the command line or through environment variables.

path_get_basename

Gets the last component of the filename.

path_get_dirname

Gets the directory components of a file name. For example, the directory component of /usr/bin/test is /usr/bin. The directory component of / is /.

path_is_absolute

Returns TRUE if the given file_name is an absolute file name. Note that this is a somewhat vague concept on Windows.

path_skip_root

Returns a pointer into file_name after the root component, i.e. after the “/” in UNIX or “C:" under Windows. If file_name is not an absolute path it returns NULL.

pattern_match

Matches a string against a compiled pattern. Passing the correct length of the string given is mandatory. The reversed string can be omitted by passing NULL, this is more efficient if the reversed version of the string to be matched is not at hand, as g_pattern_match() will only construct it if the compiled pattern requires reverse matches.

pattern_match_simple

Matches a string against a pattern given as a string. If this function is to be called in a loop, it’s more efficient to compile the pattern once with g_pattern_spec_new() and call g_pattern_match_string() repeatedly.

pattern_match_string

Matches a string against a compiled pattern. If the string is to be matched against more than one pattern, consider using g_pattern_match() instead while supplying the reversed string.

pointer_bit_lock

This is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).

pointer_bit_trylock

This is equivalent to g_bit_trylock, but working on pointers (or other pointer-sized values).

pointer_bit_unlock

This is equivalent to g_bit_unlock, but working on pointers (or other pointer-sized values).

poll

Polls fds, as with the poll() system call, but portably. (On systems that don’t have poll(), it is emulated using select().) This is used internally by GMainContext, but it can be called directly if you need to block until a file descriptor is ready, but don’t want to run the full main loop.

prefix_error

Formats a string according to format and prefix it to an existing error message. If err is NULL (ie: no error variable) then do nothing.

print

Outputs a formatted message via the print handler. The default print handler simply outputs the message to stdout, without appending a trailing new-line character. Typically, format should end with its own new-line character.

printerr

Outputs a formatted message via the error message handler. The default handler simply outputs the message to stderr, without appending a trailing new-line character. Typically, format should end with its own new-line character.

printf

An implementation of the standard printf() function which supports positional parameters, as specified in the Single Unix Specification.

printf_string_upper_bound

Calculates the maximum space needed to store the output of the sprintf() function.

propagate_error

If dest is NULL, free src; otherwise, moves src into *dest. The error variable dest points to must be NULL.

propagate_prefixed_error

If dest is NULL, free src; otherwise, moves src into dest. dest must be NULL. After the move, add a prefix as with g_prefix_error().

qsort_with_data

This is just like the standard C qsort() function, but the comparison routine accepts a user data argument.

quark_from_static_string

Gets the GQuark identifying the given (static) string. If the string does not currently have an associated GQuark, a new GQuark is created, linked to the given string.

quark_from_string

Gets the GQuark identifying the given string. If the string does not currently have an associated GQuark, a new GQuark is created, using a copy of the string.

quark_to_string

Gets the string associated with the given GQuark.

quark_try_string

Gets the GQuark associated with the given string, or 0 if string is NULL or it has no associated GQuark.

random_double

Returns a random #gdouble equally distributed over the range [0..1).

random_double_range

Returns a random #gdouble equally distributed over the range [begin..end).

random_int

Return a random #guint32 equally distributed over the range [0..2^32-1].

random_int_range

Returns a random #gint32 equally distributed over the range [begin..end-1].

random_set_seed

Sets the seed for the global random number generator, which is used by the g_random_* functions, to seed.

rc_box_acquire

Acquires a reference on the data pointed by mem_block.

rc_box_alloc

Allocates block_size bytes of memory, and adds reference counting semantics to it.

rc_box_alloc0

Allocates block_size bytes of memory, and adds reference counting semantics to it.

rc_box_dup

Allocates a new block of data with reference counting semantics, and copies block_size bytes of mem_block into it.

rc_box_get_size

Retrieves the size of the reference counted data pointed by mem_block.

rc_box_release

Releases a reference on the data pointed by mem_block.

rc_box_release_full

Releases a reference on the data pointed by mem_block.

realloc

Reallocates the memory pointed to by mem, so that it now has space for n_bytes bytes of memory. It returns the new address of the memory, which may have been moved. mem may be NULL, in which case it’s considered to have zero-length. n_bytes may be 0, in which case NULL will be returned and mem will be freed unless it is NULL.

realloc_n

This function is similar to g_realloc(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

ref_count_compare

Compares the current value of rc with val.

ref_count_dec

Decreases the reference count.

ref_count_inc

Increases the reference count.

ref_count_init

Initializes a reference count variable.

ref_string_acquire

Acquires a reference on a string.

ref_string_length

Retrieves the length of str.

ref_string_new

Creates a new reference counted string and copies the contents of str into it.

ref_string_new_intern

Creates a new reference counted string and copies the content of str into it.

ref_string_new_len

Creates a new reference counted string and copies the contents of str into it, up to len bytes.

ref_string_release

Releases a reference on a string; if it was the last reference, the resources allocated by the string are freed as well.

reload_user_special_dirs_cache

Resets the cache used for g_get_user_special_dir(), so that the latest on-disk version is used. Call this only if you just changed the data on disk yourself.

return_if_fail_warning

Internal function used to print messages from the public g_return_if_fail() and g_return_val_if_fail() macros.

rmdir

A wrapper for the POSIX rmdir() function. The rmdir() function deletes a directory from the filesystem.

set_application_name

Sets a human-readable name for the application. This name should be localized if possible, and is intended for display to the user. Contrast with g_set_prgname(), which sets a non-localized name. g_set_prgname() will be called automatically by gtk_init(), but g_set_application_name() will not.

set_error

Does nothing if err is NULL; if err is non-NULL, then err must be NULL. A new GError is created and assigned to err.

set_error_literal

Does nothing if err is NULL; if err is non-NULL, then err must be NULL. A new GError is created and assigned to err. Unlike g_set_error(), message is not a printf()-style format string. Use this function if message contains text you don’t have control over, that could include printf() escape sequences.

set_prgname

Sets the name of the program. This name should not be localized, in contrast to g_set_application_name().

set_print_handler

Sets the print handler.

set_printerr_handler

Sets the handler for printing error messages.

setenv

Sets an environment variable. On UNIX, both the variable’s name and value can be arbitrary byte strings, except that the variable’s name cannot contain ‘=’. On Windows, they should be in UTF-8.

shell_error_quark
shell_parse_argv

Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, etc. are not supported). The results are defined to be the same as those you would get from a UNIX98 /bin/sh, as long as the input contains none of the unsupported shell expansions. If the input does contain such expansions, they are passed through literally. Possible errors are those from the #G_SHELL_ERROR domain. Free the returned vector with g_strfreev().

shell_quote

Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string. If you pass a filename to the shell, for example, you should first quote it with this function. The return value must be freed with g_free(). The quoting style used is undefined (single or double quotes may be used).

shell_unquote

Unquotes a string as the shell (/bin/sh) would. Only handles quotes; if a string contains file globs, arithmetic operators, variables, backticks, redirections, or other special-to-the-shell features, the result will be different from the result a real shell would produce (the variables, backticks, etc. will be passed through literally instead of being expanded). This function is guaranteed to succeed if applied to the result of g_shell_quote(). If it fails, it returns NULL and sets the error. The quoted_string need not actually contain quoted or escaped text; g_shell_unquote() simply goes through the string and unquotes/unescapes anything that the shell would. Both single and double quotes are handled, as are escapes including escaped newlines. The return value must be freed with g_free(). Possible errors are in the #G_SHELL_ERROR domain.

slice_alloc

Allocates a block of memory from the slice allocator. The block address handed out can be expected to be aligned to at least 1 * sizeof (void), though in general slices are 2 * sizeof (void) bytes aligned, if a malloc() fallback implementation is used instead, the alignment may be reduced in a libc dependent fashion. Note that the underlying slice allocation mechanism can be changed with the [G_SLICE=always-malloc][G_SLICE] environment variable.

slice_alloc0

Allocates a block of memory via g_slice_alloc() and initializes the returned memory to 0. Note that the underlying slice allocation mechanism can be changed with the [G_SLICE=always-malloc][G_SLICE] environment variable.

slice_copy

Allocates a block of memory from the slice allocator and copies block_size bytes into it from mem_block.

slice_free1

Frees a block of memory.

slice_free_chain_with_offset

Frees a linked list of memory blocks of structure type type.

slice_get_config
slice_get_config_state
slice_set_config
snprintf

A safer form of the standard sprintf() function. The output is guaranteed to not exceed n characters (including the terminating nul character), so it is easy to ensure that a buffer overflow cannot occur.

spaced_primes_closest

Gets the smallest prime number from a built-in array of primes which is larger than num. This is used within GLib to calculate the optimum size of a GHashTable.

spawn_async

See g_spawn_async_with_pipes() for a full description; this function simply calls the g_spawn_async_with_pipes() without any pipes.

spawn_async_with_fds

Identical to g_spawn_async_with_pipes_and_fds() but with n_fds set to zero, so no FD assignments are used.

spawn_async_with_pipes

Identical to g_spawn_async_with_pipes_and_fds() but with n_fds set to zero, so no FD assignments are used.

spawn_async_with_pipes_and_fds

Executes a child program asynchronously (your program will not block waiting for the child to exit). The child program is specified by the only argument that must be provided, argv. argv should be a NULL-terminated array of strings, to be passed as the argument vector for the child. The first string in argv is of course the name of the program to execute. By default, the name of the program must be a full path. If flags contains the G_SPAWN_SEARCH_PATH flag, the PATH environment variable is used to search for the executable. If flags contains the G_SPAWN_SEARCH_PATH_FROM_ENVP flag, the PATH variable from envp is used to search for the executable. If both the G_SPAWN_SEARCH_PATH and G_SPAWN_SEARCH_PATH_FROM_ENVP flags are set, the PATH variable from envp takes precedence over the environment variable.

spawn_check_exit_status

Set error if exit_status indicates the child exited abnormally (e.g. with a nonzero exit code, or via a fatal signal).

spawn_close_pid

On some platforms, notably Windows, the GPid type represents a resource which must be closed to prevent resource leaking. g_spawn_close_pid() is provided for this purpose. It should be used on all platforms, even though it doesn’t do anything under UNIX.

spawn_command_line_async

A simple version of g_spawn_async() that parses a command line with g_shell_parse_argv() and passes it to g_spawn_async(). Runs a command line in the background. Unlike g_spawn_async(), the G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note that G_SPAWN_SEARCH_PATH can have security implications, so consider using g_spawn_async() directly if appropriate. Possible errors are those from g_shell_parse_argv() and g_spawn_async().

spawn_command_line_sync

A simple version of g_spawn_sync() with little-used parameters removed, taking a command line instead of an argument vector. See g_spawn_sync() for full details. command_line will be parsed by g_shell_parse_argv(). Unlike g_spawn_sync(), the G_SPAWN_SEARCH_PATH flag is enabled. Note that G_SPAWN_SEARCH_PATH can have security implications, so consider using g_spawn_sync() directly if appropriate. Possible errors are those from g_spawn_sync() and those from g_shell_parse_argv().

spawn_error_quark
spawn_exit_error_quark
spawn_sync

Executes a child synchronously (waits for the child to exit before returning). All output from the child is stored in standard_output and standard_error, if those parameters are non-NULL. Note that you must set the G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL flags when passing NULL for standard_output and standard_error.

sprintf

An implementation of the standard sprintf() function which supports positional parameters, as specified in the Single Unix Specification.

stpcpy

Copies a nul-terminated string into the dest buffer, include the trailing nul, and return a pointer to the trailing nul byte. This is useful for concatenating multiple strings together without having to repeatedly scan for the end.

str_equal

Compares two strings for byte-by-byte equality and returns TRUE if they are equal. It can be passed to g_hash_table_new() as the key_equal_func parameter, when using non-NULL strings as keys in a GHashTable.

str_has_prefix

Looks whether the string str begins with prefix.

str_has_suffix

Looks whether the string str ends with suffix.

str_hash

Converts a string to a hash value.

str_is_ascii

Determines if a string is pure ASCII. A string is pure ASCII if it contains no bytes with the high bit set.

str_match_string

Checks if a search conducted for search_term should match potential_hit.

str_to_ascii

Transliterate str to plain ASCII.

str_tokenize_and_fold

Tokenises string and performs folding on each token.

strcanon

For each character in string, if the character is not in valid_chars, replaces the character with substitutor. Modifies string in place, and return string itself, not a copy. The return value is to allow nesting such as

  g_ascii_strup (g_strcanon (str, "abc", '?'))
strcasecmp

A case-insensitive string comparison, corresponding to the standard strcasecmp() function on platforms which support it.

strchomp

Removes trailing whitespace from a string.

strchug

Removes leading whitespace from a string, by moving the rest of the characters forward.

strcmp0

Compares str1 and str2 like strcmp(). Handles NULL gracefully by sorting it before non-NULL strings. Comparing two NULL pointers returns 0.

strcompress

Replaces all escaped characters with their one byte equivalent.

strconcat

Concatenates all of the given strings into one long string. The returned string should be freed with g_free() when no longer needed.

strdelimit

Converts any delimiter characters in string to new_delimiter. Any characters in string which are found in delimiters are changed to the new_delimiter character. Modifies string in place, and returns string itself, not a copy. The return value is to allow nesting such as

  g_ascii_strup (g_strdelimit (str, "abc", '?'))
strdown

Converts a string to lower case.

strdup

Duplicates a string. If str is NULL it returns NULL. The returned string should be freed with g_free() when no longer needed.

strdup_printf

Similar to the standard C sprintf() function but safer, since it calculates the maximum space required and allocates memory to hold the result. The returned string should be freed with g_free() when no longer needed.

strdup_vprintf

Similar to the standard C vsprintf() function but safer, since it calculates the maximum space required and allocates memory to hold the result. The returned string should be freed with g_free() when no longer needed.

strdupv

Copies NULL-terminated array of strings. The copy is a deep copy; the new array should be freed by first freeing each string, then the array itself. g_strfreev() does this for you. If called on a NULL value, g_strdupv() simply returns NULL.

strerror

Returns a string corresponding to the given error code, e.g. “no such process”. Unlike strerror(), this always returns a string in UTF-8 encoding, and the pointer is guaranteed to remain valid for the lifetime of the process.

strescape

Escapes the special characters ‘\b’, ‘\f’, ‘\n’, ‘\r’, ‘\t’, ‘\v’, ‘' and ‘”’ in the string source by inserting a ‘' before them. Additionally all characters in the range 0x01-0x1F (everything below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are replaced with a ‘' followed by their octal representation. Characters supplied in exceptions are not escaped.

strfreev

Frees a NULL-terminated array of strings, as well as each string it contains.

string_new

Creates a new GString, initialized with the given string.

string_new_len

Creates a new GString with len bytes of the init buffer. Because a length is provided, init need not be nul-terminated, and can contain embedded nul bytes.

string_sized_new

Creates a new GString, with enough space for dfl_size bytes. This is useful if you are going to add a lot of text to the string and don’t want it to be reallocated too often.

strip_context

An auxiliary function for gettext() support (see Q_()).

strjoin

Joins a number of strings together to form one long string, with the optional separator inserted between each of them. The returned string should be freed with g_free().

strjoinv

Joins a number of strings together to form one long string, with the optional separator inserted between each of them. The returned string should be freed with g_free().

strlcat

Portability wrapper that calls strlcat() on systems which have it, and emulates it otherwise. Appends nul-terminated src string to dest, guaranteeing nul-termination for dest. The total size of dest won’t exceed dest_size.

strlcpy

Portability wrapper that calls strlcpy() on systems which have it, and emulates strlcpy() otherwise. Copies src to dest; dest is guaranteed to be nul-terminated; src must be nul-terminated; dest_size is the buffer size, not the number of bytes to copy.

strncasecmp

A case-insensitive string comparison, corresponding to the standard strncasecmp() function on platforms which support it. It is similar to g_strcasecmp() except it only compares the first n characters of the strings.

strndup

Duplicates the first n bytes of a string, returning a newly-allocated buffer n + 1 bytes long which will always be nul-terminated. If str is less than n bytes long the buffer is padded with nuls. If str is NULL it returns NULL. The returned value should be freed when no longer needed.

strnfill

Creates a new string length bytes long filled with fill_char. The returned string should be freed when no longer needed.

strreverse

Reverses all of the bytes in a string. For example, g_strreverse ("abcdef") will result in “fedcba”.

strrstr

Searches the string haystack for the last occurrence of the string needle.

strrstr_len

Searches the string haystack for the last occurrence of the string needle, limiting the length of the search to haystack_len.

strsignal

Returns a string describing the given signal, e.g. “Segmentation fault”. You should use this function in preference to strsignal(), because it returns a string in UTF-8 encoding, and since not all platforms support the strsignal() function.

strsplit

Splits a string into a maximum of max_tokens pieces, using the given delimiter. If max_tokens is reached, the remainder of string is appended to the last token.

strsplit_set

Splits string into a number of tokens not containing any of the characters in delimiter. A token is the (possibly empty) longest string that does not contain any of the characters in delimiters. If max_tokens is reached, the remainder is appended to the last token.

strstr_len

Searches the string haystack for the first occurrence of the string needle, limiting the length of the search to haystack_len.

strtod

Converts a string to a #gdouble value. It calls the standard strtod() function to handle the conversion, but if the string is not completely converted it attempts the conversion again with g_ascii_strtod(), and returns the best match.

strup

Converts a string to upper case.

strv_contains

Checks if strv contains str. strv must not be NULL.

strv_equal

Checks if strv1 and strv2 contain exactly the same elements in exactly the same order. Elements are compared using g_str_equal(). To match independently of order, sort the arrays first (using g_qsort_with_data() or similar).

strv_get_type
strv_length

Returns the length of the given NULL-terminated string array str_array. str_array must not be NULL.

test_add_data_func

Create a new test case, similar to g_test_create_case(). However the test is assumed to use no fixture, and test suites are automatically created on the fly and added to the root fixture, based on the slash-separated portions of testpath. The test_data argument will be passed as first argument to test_func.

test_add_data_func_full

Create a new test case, as with g_test_add_data_func(), but freeing test_data after the test run is complete.

test_add_func

Create a new test case, similar to g_test_create_case(). However the test is assumed to use no fixture, and test suites are automatically created on the fly and added to the root fixture, based on the slash-separated portions of testpath.

test_add_vtable
test_bug

This function adds a message to test reports that associates a bug URI with a test case. Bug URIs are constructed from a base URI set with g_test_bug_base() and bug_uri_snippet. If g_test_bug_base() has not been called, it is assumed to be the empty string, so a full URI can be provided to g_test_bug() instead.

test_bug_base

Specify the base URI for bug reports.

test_build_filename

Creates the pathname to a data file that is required for a test.

test_create_case

Create a new GTestCase, named test_name.

test_create_suite

Create a new test suite with the name suite_name.

test_expect_message

Indicates that a message with the given log_domain and log_level, with text matching pattern, is expected to be logged. When this message is logged, it will not be printed, and the test case will not abort.

test_fail

Indicates that a test failed. This function can be called multiple times from the same test. You can use this function if your test failed in a recoverable way.

test_failed

Returns whether a test has already failed. This will be the case when g_test_fail(), g_test_incomplete() or g_test_skip() have been called, but also if an assertion has failed.

test_get_dir

Gets the pathname of the directory containing test files of the type specified by file_type.

test_get_filename

Gets the pathname to a data file that is required for a test.

test_get_path

Gets the test path for the test currently being run.

test_get_root

Get the toplevel test suite for the test path API.

test_incomplete

Indicates that a test failed because of some incomplete functionality. This function can be called multiple times from the same test.

test_init

Initialize the GLib testing framework, e.g. by seeding the test random number generator, the name for g_get_prgname() and parsing test related command line args.

test_log_set_fatal_handler

Installs a non-error fatal log handler which can be used to decide whether log messages which are counted as fatal abort the program.

test_log_type_name
test_maximized_result

Report the result of a performance or measurement test. The test should generally strive to maximize the reported quantities (larger values are better than smaller ones), this and maximized_quantity can determine sorting order for test result reports.

test_message

Add a message to the test report.

test_minimized_result

Report the result of a performance or measurement test. The test should generally strive to minimize the reported quantities (smaller values are better than larger ones), this and minimized_quantity can determine sorting order for test result reports.

test_queue_destroy

This function enqueus a callback destroy_func to be executed during the next test case teardown phase. This is most useful to auto destruct allocated test resources at the end of a test run. Resources are released in reverse queue order, that means enqueueing callback A before callback B will cause B() to be called before A() during teardown.

test_queue_free

Enqueue a pointer to be released with g_free() during the next teardown phase. This is equivalent to calling g_test_queue_destroy() with a destroy callback of g_free().

test_rand_double

Get a reproducible random floating point number, see g_test_rand_int() for details on test case random numbers.

test_rand_double_range

Get a reproducible random floating pointer number out of a specified range, see g_test_rand_int() for details on test case random numbers.

test_rand_int

Get a reproducible random integer number.

test_rand_int_range

Get a reproducible random integer number out of a specified range, see g_test_rand_int() for details on test case random numbers.

test_run

Runs all tests under the toplevel suite which can be retrieved with g_test_get_root(). Similar to g_test_run_suite(), the test cases to be run are filtered according to test path arguments (-p testpath and -s testpath) as parsed by g_test_init(). g_test_run_suite() or g_test_run() may only be called once in a program.

test_run_suite

Execute the tests within suite and all nested GTestSuites. The test suites to be executed are filtered according to test path arguments (-p testpath and -s testpath) as parsed by g_test_init(). See the g_test_run() documentation for more information on the order that tests are run in.

test_set_nonfatal_assertions

Changes the behaviour of the various g_assert_*() macros, g_test_assert_expected_messages() and the various g_test_trap_assert_*() macros to not abort to program, but instead call g_test_fail() and continue. (This also changes the behavior of g_test_fail() so that it will not cause the test program to abort after completing the failed test.)

test_skip

Indicates that a test was skipped.

test_subprocess

Returns TRUE (after g_test_init() has been called) if the test program is running under g_test_trap_subprocess().

test_summary

Set the summary for a test, which describes what the test checks, and how it goes about checking it. This may be included in test report output, and is useful documentation for anyone reading the source code or modifying a test in future. It must be a single line.

test_timer_elapsed

Get the time since the last start of the timer with g_test_timer_start().

test_timer_last

Report the last result of g_test_timer_elapsed().

test_timer_start

Start a timing test. Call g_test_timer_elapsed() when the task is supposed to be done. Call this function again to restart the timer.

test_trap_assertions
test_trap_fork

Fork the current test program to execute a test case that might not return or that might abort.

test_trap_has_passed

Check the result of the last g_test_trap_subprocess() call.

test_trap_reached_timeout

Check the result of the last g_test_trap_subprocess() call.

test_trap_subprocess

Respawns the test program to run only test_path in a subprocess. This can be used for a test case that might not return, or that might abort.

timeout_add

Sets a function to be called at regular intervals, with the default priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again. The first call to the function will be at the end of the first interval.

timeout_add_full

Sets a function to be called at regular intervals, with the given priority. The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again. The notify function is called when the timeout is destroyed. The first call to the function will be at the end of the first interval.

timeout_add_seconds

Sets a function to be called at regular intervals with the default priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again.

timeout_add_seconds_full

Sets a function to be called at regular intervals, with priority. The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again.

timeout_source_new

Creates a new timeout source.

timeout_source_new_seconds

Creates a new timeout source.

try_malloc

Attempts to allocate n_bytes, and returns NULL on failure. Contrast with g_malloc(), which aborts the program on failure.

try_malloc0

Attempts to allocate n_bytes, initialized to 0’s, and returns NULL on failure. Contrast with g_malloc0(), which aborts the program on failure.

try_malloc0_n

This function is similar to g_try_malloc0(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

try_malloc_n

This function is similar to g_try_malloc(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

try_realloc

Attempts to realloc mem to a new size, n_bytes, and returns NULL on failure. Contrast with g_realloc(), which aborts the program on failure.

try_realloc_n

This function is similar to g_try_realloc(), allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

ucs4_to_utf16

Convert a string from UCS-4 to UTF-16. A 0 character will be added to the result after the converted text.

ucs4_to_utf8

Convert a string from a 32-bit fixed width representation as UCS-4. to UTF-8. The result will be terminated with a 0 byte.

unichar_break_type

Determines the break type of c. c should be a Unicode character (to derive a character from UTF-8 encoded text, use g_utf8_get_char()). The break type is used to find word and line breaks (“text boundaries”), Pango implements the Unicode boundary resolution algorithms and normally you would use a function such as pango_break() instead of caring about break types yourself.

unichar_combining_class

Determines the canonical combining class of a Unicode character.

unichar_compose

Performs a single composition step of the Unicode canonical composition algorithm.

unichar_decompose

Performs a single decomposition step of the Unicode canonical decomposition algorithm.

unichar_digit_value

Determines the numeric value of a character as a decimal digit.

unichar_fully_decompose

Computes the canonical or compatibility decomposition of a Unicode character. For compatibility decomposition, pass TRUE for compat; for canonical decomposition pass FALSE for compat.

unichar_get_mirror_char

In Unicode, some characters are “mirrored”. This means that their images are mirrored horizontally in text that is laid out from right to left. For instance, “(” would become its mirror image, “)”, in right-to-left text.

unichar_get_script

Looks up the GUnicodeScript for a particular character (as defined by Unicode Standard Annex #24). No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined.

unichar_isalnum

Determines whether a character is alphanumeric. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_isalpha

Determines whether a character is alphabetic (i.e. a letter). Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_iscntrl

Determines whether a character is a control character. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_isdefined

Determines if a given character is assigned in the Unicode standard.

unichar_isdigit

Determines whether a character is numeric (i.e. a digit). This covers ASCII 0-9 and also digits in other languages/scripts. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_isgraph

Determines whether a character is printable and not a space (returns FALSE for control characters, format characters, and spaces). g_unichar_isprint() is similar, but returns TRUE for spaces. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_islower

Determines whether a character is a lowercase letter. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_ismark

Determines whether a character is a mark (non-spacing mark, combining mark, or enclosing mark in Unicode speak). Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_isprint

Determines whether a character is printable. Unlike g_unichar_isgraph(), returns TRUE for spaces. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_ispunct

Determines whether a character is punctuation or a symbol. Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_isspace

Determines whether a character is a space, tab, or line separator (newline, carriage return, etc.). Given some UTF-8 text, obtain a character value with g_utf8_get_char().

unichar_istitle

Determines if a character is titlecase. Some characters in Unicode which are composites, such as the DZ digraph have three case variants instead of just two. The titlecase form is used at the beginning of a word where only the first letter is capitalized. The titlecase form of the DZ digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.

unichar_isupper

Determines if a character is uppercase.

unichar_iswide

Determines if a character is typically rendered in a double-width cell.

unichar_iswide_cjk

Determines if a character is typically rendered in a double-width cell under legacy East Asian locales. If a character is wide according to g_unichar_iswide(), then it is also reported wide with this function, but the converse is not necessarily true. See the Unicode Standard Annex #11 for details.

unichar_isxdigit

Determines if a character is a hexadecimal digit.

unichar_iszerowidth

Determines if a given character typically takes zero width when rendered. The return value is TRUE for all non-spacing and enclosing marks (e.g., combining accents), format characters, zero-width space, but not U+00AD SOFT HYPHEN.

unichar_to_utf8

Converts a single character to UTF-8.

unichar_tolower

Converts a character to lower case.

unichar_totitle

Converts a character to the titlecase.

unichar_toupper

Converts a character to uppercase.

unichar_type

Classifies a Unicode character by type.

unichar_validate

Checks whether ch is a valid Unicode character. Some possible integer values of ch will not be valid. 0 is considered a valid character, though it’s normally a string terminator.

unichar_xdigit_value

Determines the numeric value of a character as a hexadecimal digit.

unicode_canonical_decomposition

Computes the canonical decomposition of a Unicode character.

unicode_canonical_ordering

Computes the canonical ordering of a string in-place. This rearranges decomposed characters in the string according to their combining classes. See the Unicode manual for more information.

unicode_script_from_iso15924

Looks up the Unicode script for iso15924. ISO 15924 assigns four-letter codes to scripts. For example, the code for Arabic is ‘Arab’. This function accepts four letter codes encoded as a guint32 in a big-endian fashion. That is, the code expected for Arabic is 0x41726162 (0x41 is ASCII code for ‘A’, 0x72 is ASCII code for ‘r’, etc).

unicode_script_to_iso15924

Looks up the ISO 15924 code for script. ISO 15924 assigns four-letter codes to scripts. For example, the code for Arabic is ‘Arab’. The four letter codes are encoded as a guint32 by this function in a big-endian fashion. That is, the code returned for Arabic is 0x41726162 (0x41 is ASCII code for ‘A’, 0x72 is ASCII code for ‘r’, etc).

unix_error_quark
unix_fd_add

Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

unix_fd_add_full

Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

unix_fd_source_new

Creates a GSource to watch for a particular IO condition on a file descriptor.

unix_get_passwd_entry

Get the passwd file entry for the given user_name using getpwnam_r(). This can fail if the given user_name doesn’t exist.

unix_open_pipe

Similar to the UNIX pipe() call, but on modern systems like Linux uses the pipe2() system call, which atomically creates a pipe with the configured flags. The only supported flag currently is FD_CLOEXEC. If for example you want to configure O_NONBLOCK, that must still be done separately with fcntl().

unix_set_fd_nonblocking

Control the non-blocking state of the given file descriptor, according to nonblock. On most systems this uses O_NONBLOCK, but on some older ones may use O_NDELAY.

unix_signal_add

A convenience function for g_unix_signal_source_new(), which attaches to the default GMainContext. You can remove the watch using g_source_remove().

unix_signal_add_full

A convenience function for g_unix_signal_source_new(), which attaches to the default GMainContext. You can remove the watch using g_source_remove().

unix_signal_source_new

Create a GSource that will be dispatched upon delivery of the UNIX signal signum. In GLib versions before 2.36, only SIGHUP, SIGINT, SIGTERM can be monitored. In GLib 2.36, SIGUSR1 and SIGUSR2 were added. In GLib 2.54, SIGWINCH was added.

unlink

A wrapper for the POSIX unlink() function. The unlink() function deletes a name from the filesystem. If this was the last link to the file and no processes have it opened, the diskspace occupied by the file is freed.

unsetenv

Removes an environment variable from the environment.

usleep

Pauses the current thread for the given number of microseconds.

utf16_to_ucs4

Convert a string from UTF-16 to UCS-4. The result will be nul-terminated.

utf16_to_utf8

Convert a string from UTF-16 to UTF-8. The result will be terminated with a 0 byte.

utf8_casefold

Converts a string into a form that is independent of case. The result will not correspond to any particular case, but can be compared for equality or ordered with the results of calling g_utf8_casefold() on other strings.

utf8_collate

Compares two strings for ordering using the linguistically correct rules for the [current locale][setlocale]. When sorting a large number of strings, it will be significantly faster to obtain collation keys with g_utf8_collate_key() and compare the keys with strcmp() when sorting instead of sorting the original strings.

utf8_collate_key

Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().

utf8_collate_key_for_filename

Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().

utf8_find_next_char

Finds the start of the next UTF-8 character in the string after p.

utf8_find_prev_char

Given a position p with a UTF-8 encoded string str, find the start of the previous UTF-8 character starting before p. Returns NULL if no UTF-8 characters are present in str before p.

utf8_get_char

Converts a sequence of bytes encoded as UTF-8 to a Unicode character.

utf8_get_char_validated

Convert a sequence of bytes encoded as UTF-8 to a Unicode character. This function checks for incomplete characters, for invalid characters such as characters that are out of the range of Unicode, and for overlong encodings of valid characters.

utf8_make_valid

If the provided string is valid UTF-8, return a copy of it. If not, return a copy in which bytes that could not be interpreted as valid Unicode are replaced with the Unicode replacement character (U+FFFD).

utf8_normalize

Converts a string into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. The string has to be valid UTF-8, otherwise NULL is returned. You should generally call g_utf8_normalize() before comparing two Unicode strings.

utf8_offset_to_pointer

Converts from an integer character offset to a pointer to a position within the string.

utf8_pointer_to_offset

Converts from a pointer to position within a string to an integer character offset.

utf8_prev_char

Finds the previous UTF-8 character in the string before p.

utf8_strchr

Finds the leftmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len bytes. If len is -1, allow unbounded search.

utf8_strdown

Converts all Unicode characters in the string that have a case to lowercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string changing.

utf8_strlen

Computes the length of the string in characters, not including the terminating nul character. If the maxth byte falls in the middle of a character, the last (partial) character is not counted.

utf8_strncpy

Like the standard C strncpy() function, but copies a given number of characters instead of a given number of bytes. The src string must be valid UTF-8 encoded text. (Use g_utf8_validate() on all text before trying to use UTF-8 utility functions with it.)

utf8_strrchr

Find the rightmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len bytes. If len is -1, allow unbounded search.

utf8_strreverse

Reverses a UTF-8 string. str must be valid UTF-8 encoded text. (Use g_utf8_validate() on all text before trying to use UTF-8 utility functions with it.)

utf8_strup

Converts all Unicode characters in the string that have a case to uppercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string increasing. (For instance, the German ess-zet will be changed to SS.)

utf8_substring

Copies a substring out of a UTF-8 encoded string. The substring will contain end_pos - start_pos characters.

utf8_to_ucs4

Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4. A trailing 0 character will be added to the string after the converted text.

utf8_to_ucs4_fast

Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4, assuming valid UTF-8 input. This function is roughly twice as fast as g_utf8_to_ucs4() but does no error checking on the input. A trailing 0 character will be added to the string after the converted text.

utf8_to_utf16

Convert a string from UTF-8 to UTF-16. A 0 character will be added to the result after the converted text.

utf8_validate

Validates UTF-8 encoded text. str is the text to validate; if str is nul-terminated, then max_len can be -1, otherwise max_len should be the number of bytes to validate. If end is non-NULL, then the end of the valid range will be stored there (i.e. the start of the first invalid character if some bytes were invalid, or the end of the text being validated otherwise).

utf8_validate_len

Validates UTF-8 encoded text.

uuid_string_is_valid

Parses the string str and verify if it is a UUID.

uuid_string_random

Generates a random UUID (RFC 4122 version 4) as a string. It has the same randomness guarantees as GRand, so must not be used for cryptographic purposes such as key generation, nonces, salts or one-time pads.

variant_get_gtype
vasprintf

An implementation of the GNU vasprintf() function which supports positional parameters, as specified in the Single Unix Specification. This function is similar to g_vsprintf(), except that it allocates a string to hold the output, instead of putting the output in a buffer you allocate in advance.

vfprintf

An implementation of the standard fprintf() function which supports positional parameters, as specified in the Single Unix Specification.

vprintf

An implementation of the standard vprintf() function which supports positional parameters, as specified in the Single Unix Specification.

vsnprintf

A safer form of the standard vsprintf() function. The output is guaranteed to not exceed n characters (including the terminating nul character), so it is easy to ensure that a buffer overflow cannot occur.

vsprintf

An implementation of the standard vsprintf() function which supports positional parameters, as specified in the Single Unix Specification.

warn_message

Internal function used to print messages from the public g_warn_if_reached() and g_warn_if_fail() macros.

Function Macros

ALIGNOF

Return the minimal alignment required by the platform ABI for values of the given type. The address of a variable or struct member of the given type must always be a multiple of this alignment. For example, most platforms require int variables to be aligned at a 4-byte boundary, so G_ALIGNOF (int) is 4 on most platforms.

alloca

Allocates size bytes on the stack; these bytes will be freed when the current stack frame is cleaned up. This macro essentially just wraps the alloca() function present on most UNIX variants. Thus it provides the same advantages and pitfalls as alloca():

APPROX_VALUE

Evaluates to a truth value if the absolute difference between a and b is smaller than epsilon, and to a false value otherwise.

array_append_val

Adds the value on to the end of the array. The array will grow in size automatically if necessary.

array_index

Returns the element of a GArray at the given index. The return value is cast to the given type. This is the main way to read or write an element in a GArray.

array_insert_val

Inserts an element into an array at the given index.

array_prepend_val

Adds the value on to the start of the array. The array will grow in size automatically if necessary.

ascii_isalnum

Determines whether a character is alphanumeric.

ascii_isalpha

Determines whether a character is alphabetic (i.e. a letter).

ascii_iscntrl

Determines whether a character is a control character.

ascii_isdigit

Determines whether a character is digit (0-9).

ascii_isgraph

Determines whether a character is a printing character and not a space.

ascii_islower

Determines whether a character is an ASCII lower case letter.

ascii_isprint

Determines whether a character is a printing character.

ascii_ispunct

Determines whether a character is a punctuation character.

ascii_isspace

Determines whether a character is a white-space character.

ascii_isupper

Determines whether a character is an ASCII upper case letter.

ascii_isxdigit

Determines whether a character is a hexadecimal-digit character.

assert

Debugging macro to terminate the application if the assertion fails. If the assertion fails (i.e. the expression is not true), an error message is logged and the application is terminated.

assert_cmpfloat

Debugging macro to compare two floating point numbers.

assert_cmpfloat_with_epsilon

Debugging macro to compare two floating point numbers within an epsilon.

assert_cmphex

Debugging macro to compare to unsigned integers.

assert_cmpint

Debugging macro to compare two integers.

assert_cmpmem

Debugging macro to compare memory regions. If the comparison fails, an error message is logged and the application is either terminated or the testcase marked as failed.

assert_cmpstr

Debugging macro to compare two strings. If the comparison fails, an error message is logged and the application is either terminated or the testcase marked as failed. The strings are compared using g_strcmp0().

assert_cmpstrv

Debugging macro to check if two NULL-terminated string arrays (i.e. 2 GStrv) are equal. If they are not equal, an error message is logged and the application is either terminated or the testcase marked as failed. If both arrays are NULL, the check passes. If one array is NULL but the other is not, an error message is logged.

assert_cmpuint

Debugging macro to compare two unsigned integers.

assert_cmpvariant

Debugging macro to compare two GVariants. If the comparison fails, an error message is logged and the application is either terminated or the testcase marked as failed. The variants are compared using g_variant_equal().

assert_error

Debugging macro to check that a method has returned the correct GError.

assert_false

Debugging macro to check an expression is false.

assert_no_errno

Debugging macro to check that an expression has a non-negative return value, as used by traditional POSIX functions (such as rmdir()) to indicate success.

assert_no_error

Debugging macro to check that a GError is not set.

assert_nonnull

Debugging macro to check an expression is not NULL.

assert_null

Debugging macro to check an expression is NULL.

assert_true

Debugging macro to check that an expression is true.

ATEXIT
atomic_rc_box_new

A convenience macro to allocate atomically reference counted data with the size of the given type.

atomic_rc_box_new0

A convenience macro to allocate atomically reference counted data with the size of the given type, and set its contents to zero.

CHECK_VERSION

Checks the version of the GLib library that is being compiled against. See glib_check_version() for a runtime check.

datalist_id_remove_data

Removes an element, using its GQuark identifier.

datalist_id_set_data

Sets the data corresponding to the given GQuark id. Any previous data with the same key is removed, and its destroy function is called.

datalist_remove_data

Removes an element using its string identifier. The data element’s destroy function is called if it has been set.

datalist_remove_no_notify

Removes an element, without calling its destroy notifier.

datalist_set_data

Sets the data element corresponding to the given string identifier.

datalist_set_data_full

Sets the data element corresponding to the given string identifier, and the function to be called when the data element is removed.

dataset_get_data

Gets the data element corresponding to a string.

dataset_id_remove_data

Removes a data element from a dataset. The data element’s destroy function is called if it has been set.

dataset_id_set_data

Sets the data element associated with the given GQuark id. Any previous data with the same key is removed, and its destroy function is called.

dataset_remove_data

Removes a data element corresponding to a string. Its destroy function is called if it has been set.

dataset_remove_no_notify

Removes an element, without calling its destroy notifier.

dataset_set_data

Sets the data corresponding to the given string identifier.

dataset_set_data_full

Sets the data corresponding to the given string identifier, and the function to call when the data element is destroyed.

DEFINE_AUTO_CLEANUP_CLEAR_FUNC

Defines the appropriate cleanup function for a type.

DEFINE_AUTO_CLEANUP_FREE_FUNC

Defines the appropriate cleanup function for a type.

DEFINE_AUTOPTR_CLEANUP_FUNC

Defines the appropriate cleanup function for a pointer type.

DEFINE_EXTENDED_ERROR

A convenience macro which defines two functions. First, returning the GQuark for the extended error type ErrorType; it is called error_type_quark(). Second, returning the private data from a passed GError; it is called error_type_get_private().

DEFINE_QUARK

A convenience macro which defines a function returning the GQuark for the name QN. The function will be named q_n_quark().

DEPRECATED_ENUMERATOR_FOR
DEPRECATED_FOR

This macro is similar to G_GNUC_DEPRECATED_FOR, and can be used to mark functions declarations as deprecated. Unlike G_GNUC_DEPRECATED_FOR, it is meant to be portable across different compilers and must be placed before the function declaration.

DEPRECATED_MACRO_FOR
DEPRECATED_TYPE_FOR
ENCODE_VERSION
GINT64_CONSTANT

This macro is used to insert 64-bit integer literals into the source code.

GNUC_ALLOC_SIZE

Expands to the GNU C alloc_size function attribute if the compiler is a new enough gcc. This attribute tells the compiler that the function returns a pointer to memory of a size that is specified by the xth function parameter.

GNUC_ALLOC_SIZE2

Expands to the GNU C alloc_size function attribute if the compiler is a new enough gcc. This attribute tells the compiler that the function returns a pointer to memory of a size that is specified by the product of two function parameters.

GNUC_CHECK_VERSION

Expands to a check for a compiler with GNUC defined and a version greater than or equal to the major and minor numbers provided. For example, the following would only match on compilers such as GCC 4.8 or newer.

GNUC_DEPRECATED_FOR

Like G_GNUC_DEPRECATED, but names the intended replacement for the deprecated symbol if the version of gcc in use is new enough to support custom deprecation messages.

GNUC_FORMAT

Expands to the GNU C format_arg function attribute if the compiler is gcc. This function attribute specifies that a function takes a format string for a printf(), scanf(), strftime() or strfmon() style function and modifies it, so that the result can be passed to a printf(), scanf(), strftime() or strfmon() style function (with the remaining arguments to the format function the same as they would have been for the unmodified string).

GNUC_PRINTF

Expands to the GNU C format function attribute if the compiler is gcc. This is used for declaring functions which take a variable number of arguments, with the same syntax as printf(). It allows the compiler to type-check the arguments passed to the function.

GNUC_SCANF

Expands to the GNU C format function attribute if the compiler is gcc. This is used for declaring functions which take a variable number of arguments, with the same syntax as scanf(). It allows the compiler to type-check the arguments passed to the function.

GNUC_STRFTIME

Expands to the GNU C strftime format function attribute if the compiler is gcc. This is used for declaring functions which take a format argument which is passed to strftime() or an API implementing its formats. It allows the compiler check the format passed to the function.

GOFFSET_CONSTANT

This macro is used to insert #goffset 64-bit integer literals into the source code.

GUINT64_CONSTANT

This macro is used to insert 64-bit unsigned integer literals into the source code.

hash_table_freeze

This function is deprecated and will be removed in the next major release of GLib. It does nothing.

hash_table_thaw

This function is deprecated and will be removed in the next major release of GLib. It does nothing.

HOOK_ACTIVE

Returns TRUE if the GHook is active, which is normally the case until the GHook is destroyed.

hook_append

Appends a GHook onto the end of a GHookList.

HOOK_FLAGS

Gets the flags of a hook.

HOOK_IN_CALL

Returns TRUE if the GHook function is currently executing.

htonl

Converts a 32-bit integer value from host to network byte order.

htons

Converts a 16-bit integer value from host to network byte order.

LIKELY

Hints the compiler that the expression is likely to evaluate to a true value. The compiler may use this information for optimizations.

list_next

A convenience macro to get the next element in a GList. Note that it is considered perfectly acceptable to access list->next directly.

list_previous

A convenience macro to get the previous element in a GList. Note that it is considered perfectly acceptable to access list->prev directly.

LOCK

Works like g_mutex_lock(), but for a lock defined with

G_LOCK_DEFINE.

LOCK_DEFINE

The #G_LOCK_ macros provide a convenient interface to GMutex.

G_LOCK_DEFINE defines a lock. It can appear in any place where

variable definitions may appear in programs, i.e. in the first block of a function or outside of functions. The name parameter will be mangled to get the name of the GMutex. This means that you can use names of existing variables as the parameter - e.g. the name of the variable you intend to protect with the lock. Look at our give_me_next_number() example using the #G_LOCK macros:

LOCK_DEFINE_STATIC

This works like #G_LOCK_DEFINE, but it creates a static object.

LOCK_EXTERN

This declares a lock, that is defined with #G_LOCK_DEFINE in another module.

LOCK_NAME
memmove

Copies a block of memory len bytes long, from src to dest. The source and destination areas may overlap.

N_ELEMENTS

Determines the number of elements in an array. The array must be declared so the compiler knows its size at compile-time; this macro will not work on an array allocated on the heap, only static arrays or arrays on the stack.

new

Allocates n_structs elements of type struct_type. The returned pointer is cast to a pointer to the given type. If n_structs is 0 it returns NULL. Care is taken to avoid overflow when calculating the size of the allocated block.

new0

Allocates n_structs elements of type struct_type, initialized to 0’s. The returned pointer is cast to a pointer to the given type. If n_structs is 0 it returns NULL. Care is taken to avoid overflow when calculating the size of the allocated block.

newa

Wraps g_alloca() in a more typesafe manner.

node_append

Inserts a GNode as the last child of the given parent.

node_append_data

Inserts a new GNode as the last child of the given parent.

node_first_child

Gets the first child of a GNode.

node_insert_data

Inserts a new GNode at the given position.

node_insert_data_after

Inserts a new GNode after the given sibling.

node_insert_data_before

Inserts a new GNode before the given sibling.

node_next_sibling

Gets the next sibling of a GNode.

node_prepend_data

Inserts a new GNode as the first child of the given parent.

node_prev_sibling

Gets the previous sibling of a GNode.

ntohl

Converts a 32-bit integer value from network to host byte order.

ntohs

Converts a 16-bit integer value from network to host byte order.

once

The first call to this routine by a process with a given GOnce struct calls func with the given argument. Thereafter, subsequent calls to g_once() with the same GOnce struct do not call func again, but return the stored result of the first call. On return from g_once(), the status of once will be G_ONCE_STATUS_READY.

PRIVATE_INIT

A macro to assist with the static initialisation of a GPrivate.

ptr_array_index

Returns the pointer at the given index of the pointer array.

rand_boolean

Returns a random #gboolean from rand_. This corresponds to an unbiased coin toss.

rc_box_new

A convenience macro to allocate reference counted data with the size of the given type.

rc_box_new0

A convenience macro to allocate reference counted data with the size of the given type, and set its contents to zero.

renew

Reallocates the memory pointed to by mem, so that it now has space for n_structs elements of type struct_type. It returns the new address of the memory, which may have been moved. Care is taken to avoid overflow when calculating the size of the allocated block.

return_if_fail
return_val_if_fail
return_val_if_reached
scanner_add_symbol

Adds a symbol to the default scope.

scanner_foreach_symbol

Calls a function for each symbol in the default scope.

scanner_freeze_symbol_table

There is no reason to use this macro, since it does nothing.

scanner_remove_symbol

Removes a symbol from the default scope.

scanner_thaw_symbol_table

There is no reason to use this macro, since it does nothing.

size_checked_add

Performs a checked addition of a and b, storing the result in dest.

size_checked_mul

Performs a checked multiplication of a and b, storing the result in dest.

SIZEOF_MEMBER

Returns the size of member in the struct definition without having a declared instance of struct_type.

slice_dup

A convenience macro to duplicate a block of memory using the slice allocator.

slice_free

A convenience macro to free a block of memory that has been allocated from the slice allocator.

slice_free_chain

Frees a linked list of memory blocks of structure type type. The memory blocks must be equal-sized, allocated via g_slice_alloc() or g_slice_alloc0() and linked together by a next pointer (similar to GSList). The name of the next field in type is passed as third argument. Note that the exact release behaviour can be changed with the [G_DEBUG=gc-friendly][G_DEBUG] environment variable, also see [G_SLICE][G_SLICE] for related debugging options.

slice_new

A convenience macro to allocate a block of memory from the slice allocator.

slice_new0

A convenience macro to allocate a block of memory from the slice allocator and set the memory to 0.

slist_next

A convenience macro to get the next element in a GSList. Note that it is considered perfectly acceptable to access slist->next directly.

SOURCE_FUNC

Cast a function pointer to a GSourceFunc, suppressing warnings from GCC 8 onwards with -Wextra or -Wcast-function-type enabled about the function types being incompatible.

steal_pointer

Sets pp to NULL, returning the value that was there before.

STRINGIFY

Accepts a macro or a string and converts it into a string after preprocessor argument expansion. For example, the following code:

STRINGIFY_ARG
strstrip

Removes leading and trailing whitespace from a string. See g_strchomp() and g_strchug().

STRUCT_MEMBER

Returns a member of a structure at a given offset, using the given type.

STRUCT_MEMBER_P

Returns an untyped pointer to a given offset of a struct.

STRUCT_OFFSET

Returns the offset, in bytes, of a member of a struct.

test_add

Hook up a new test case at testpath, similar to g_test_add_func(). A fixture data structure with setup and teardown functions may be provided, similar to g_test_create_case().

test_queue_unref

Enqueue an object to be released with g_object_unref() during the next teardown phase. This is equivalent to calling g_test_queue_destroy() with a destroy callback of g_object_unref().

test_trap_assert_stderr

Assert that the stderr output of the last test subprocess matches serrpattern. See g_test_trap_subprocess().

test_trap_assert_stderr_unmatched

Assert that the stderr output of the last test subprocess does not match serrpattern. See g_test_trap_subprocess().

test_trap_assert_stdout

Assert that the stdout output of the last test subprocess matches soutpattern. See g_test_trap_subprocess().

test_trap_assert_stdout_unmatched

Assert that the stdout output of the last test subprocess does not match soutpattern. See g_test_trap_subprocess().

try_new

Attempts to allocate n_structs elements of type struct_type, and returns NULL on failure. Contrast with g_new(), which aborts the program on failure. The returned pointer is cast to a pointer to the given type. The function returns NULL when n_structs is 0 of if an overflow occurs.

try_new0

Attempts to allocate n_structs elements of type struct_type, initialized to 0’s, and returns NULL on failure. Contrast with g_new0(), which aborts the program on failure. The returned pointer is cast to a pointer to the given type. The function returns NULL when n_structs is 0 or if an overflow occurs.

try_renew

Attempts to reallocate the memory pointed to by mem, so that it now has space for n_structs elements of type struct_type, and returns NULL on failure. Contrast with g_renew(), which aborts the program on failure. It returns the new address of the memory, which may have been moved. The function returns NULL if an overflow occurs.

TRYLOCK

Works like g_mutex_trylock(), but for a lock defined with

G_LOCK_DEFINE.

typeof
uint64_checked_add

Performs a checked addition of a and b, storing the result in dest.

uint64_checked_mul

Performs a checked multiplication of a and b, storing the result in dest.

uint_checked_add

Performs a checked addition of a and b, storing the result in dest.

uint_checked_mul

Performs a checked multiplication of a and b, storing the result in dest.

UNAVAILABLE

This macro can be used to mark a function declaration as unavailable. It must be placed before the function declaration. Use of a function that has been annotated with this macros will produce a compiler warning.

UNAVAILABLE_ENUMERATOR
UNAVAILABLE_MACRO
UNAVAILABLE_STATIC_INLINE
UNAVAILABLE_TYPE
UNLIKELY

Hints the compiler that the expression is unlikely to evaluate to a true value. The compiler may use this information for optimizations.

UNLOCK

Works like g_mutex_unlock(), but for a lock defined with

G_LOCK_DEFINE.

utf8_next_char

Skips to the next character in a UTF-8 string. The string must be valid; this macro is as fast as possible, and has no error-checking. You would use this macro to iterate over a string character by character. The macro returns the start of the next UTF-8 character. Before using this macro, use g_utf8_validate() to validate strings that may contain invalid UTF-8.

VA_COPY

Portable way to copy va_list variables.

VARIANT_BUILDER_INIT

A stack-allocated GVariantBuilder must be initialized if it is used together with g_auto() to avoid warnings or crashes if function returns before g_variant_builder_init() is called on the builder. This macro can be used as initializer instead of an explicit zeroing a variable when declaring it and a following g_variant_builder_init(), but it cannot be assigned to a variable.

VARIANT_DICT_INIT

A stack-allocated GVariantDict must be initialized if it is used together with g_auto() to avoid warnings or crashes if function returns before g_variant_dict_init() is called on the builder. This macro can be used as initializer instead of an explicit zeroing a variable when declaring it and a following g_variant_dict_init(), but it cannot be assigned to a variable.

warn_if_fail

Logs a warning if the expression is not true.

WIN32_DLLMAIN_FOR_DLL_NAME

On Windows, this macro defines a DllMain() function that stores the actual DLL name that the code being compiled will be included in.

Constants

ANALYZER_ANALYZING
ASCII_DTOSTR_BUF_SIZE

A good size for a buffer to be passed into g_ascii_dtostr(). It is guaranteed to be enough for all output of that function on systems with 64bit IEEE-compatible doubles.

BIG_ENDIAN

Specifies one of the possible types of byte order. See #G_BYTE_ORDER.

CSET_A_2_Z

The set of uppercase ASCII alphabet characters. Used for specifying valid identifier characters in GScannerConfig.

CSET_a_2_z

The set of lowercase ASCII alphabet characters. Used for specifying valid identifier characters in GScannerConfig.

CSET_DIGITS

The set of ASCII digits. Used for specifying valid identifier characters in GScannerConfig.

DATALIST_FLAGS_MASK

A bitmask that restricts the possible flags passed to g_datalist_set_flags(). Passing a flags value where flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.

DATE_BAD_DAY

Represents an invalid GDateDay.

DATE_BAD_JULIAN

Represents an invalid Julian day number.

DATE_BAD_YEAR

Represents an invalid year.

DIR_SEPARATOR

The directory separator character. This is ‘/’ on UNIX machines and ‘' under Windows.

DIR_SEPARATOR_S

The directory separator as a string. This is “/” on UNIX machines and “" under Windows.

E

The base of natural logarithms.

GINT16_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gint16. It is a string literal, but doesn’t include the percent-sign, such that you can add precision and length modifiers between percent-sign and conversion specifier.

GINT16_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gint16 or #guint16. It is a string literal, but doesn’t include the percent-sign, such that you can add precision and length modifiers between percent-sign and conversion specifier and append a conversion specifier.

GINT32_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gint32. See also #G_GINT16_FORMAT.

GINT32_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gint32 or #guint32. It is a string literal. See also #G_GINT16_MODIFIER.

GINT64_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gint64. See also #G_GINT16_FORMAT.

GINT64_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gint64 or #guint64. It is a string literal.

GINTPTR_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gintptr.

GINTPTR_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gintptr or #guintptr. It is a string literal.

GNUC_FUNCTION

Expands to “” on all modern compilers, and to FUNCTION on gcc version 2.x. Don’t use it.

GNUC_PRETTY_FUNCTION

Expands to “” on all modern compilers, and to PRETTY_FUNCTION on gcc version 2.x. Don’t use it.

GSIZE_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gsize. See also #G_GINT16_FORMAT.

GSIZE_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gsize. It is a string literal.

GSSIZE_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #gssize. See also #G_GINT16_FORMAT.

GSSIZE_MODIFIER

The platform dependent length modifier for conversion specifiers for scanning and printing values of type #gssize. It is a string literal.

GUINT16_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #guint16. See also #G_GINT16_FORMAT.

GUINT32_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #guint32. See also #G_GINT16_FORMAT.

GUINT64_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #guint64. See also #G_GINT16_FORMAT.

GUINTPTR_FORMAT

This is the platform dependent conversion specifier for scanning and printing values of type #guintptr.

HAVE_GINT64
HAVE_GNUC_VARARGS
HAVE_GNUC_VISIBILITY

Defined to 1 if gcc-style visibility handling is supported.

HAVE_GROWING_STACK
HAVE_ISO_VARARGS
HOOK_FLAG_USER_SHIFT

The position of the first bit which is not reserved for internal use be the GHook implementation, i.e. 1 << G_HOOK_FLAG_USER_SHIFT is the first bit which can be used for application-defined flags.

IEEE754_DOUBLE_BIAS

The bias by which exponents in double-precision floats are offset.

IEEE754_FLOAT_BIAS

The bias by which exponents in single-precision floats are offset.

KEY_FILE_DESKTOP_GROUP

The name of the main group of a desktop entry file, as defined in the Desktop Entry Specification. Consult the specification for more details about the meanings of the keys below.

KEY_FILE_DESKTOP_KEY_ACTIONS

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string list giving the available application actions.

KEY_FILE_DESKTOP_KEY_CATEGORIES

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of strings giving the categories in which the desktop entry should be shown in a menu.

KEY_FILE_DESKTOP_KEY_COMMENT

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized string giving the tooltip for the desktop entry.

KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean set to true if the application is D-Bus activatable.

KEY_FILE_DESKTOP_KEY_EXEC

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string giving the command line to execute. It is only valid for desktop entries with the Application type.

KEY_FILE_DESKTOP_KEY_GENERIC_NAME

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized string giving the generic name of the desktop entry.

KEY_FILE_DESKTOP_KEY_HIDDEN

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean stating whether the desktop entry has been deleted by the user.

KEY_FILE_DESKTOP_KEY_ICON

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized string giving the name of the icon to be displayed for the desktop entry.

KEY_FILE_DESKTOP_KEY_MIME_TYPE

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of strings giving the MIME types supported by this desktop entry.

KEY_FILE_DESKTOP_KEY_NAME

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a localized string giving the specific name of the desktop entry.

KEY_FILE_DESKTOP_KEY_NO_DISPLAY

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean stating whether the desktop entry should be shown in menus.

KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of strings identifying the environments that should not display the desktop entry.

KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a list of strings identifying the environments that should display the desktop entry.

KEY_FILE_DESKTOP_KEY_PATH

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string containing the working directory to run the program in. It is only valid for desktop entries with the Application type.

KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean stating whether the application supports the Startup Notification Protocol Specification.

KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is string identifying the WM class or name hint of a window that the application will create, which can be used to emulate Startup Notification with older applications.

KEY_FILE_DESKTOP_KEY_TERMINAL

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a boolean stating whether the program should be run in a terminal window. It is only valid for desktop entries with the Application type.

KEY_FILE_DESKTOP_KEY_TRY_EXEC

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string giving the file name of a binary on disk used to determine if the program is actually installed. It is only valid for desktop entries with the Application type.

KEY_FILE_DESKTOP_KEY_TYPE

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string giving the type of the desktop entry. Usually

G_KEY_FILE_DESKTOP_TYPE_APPLICATION,

G_KEY_FILE_DESKTOP_TYPE_LINK, or

G_KEY_FILE_DESKTOP_TYPE_DIRECTORY.

KEY_FILE_DESKTOP_KEY_URL

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string giving the URL to access. It is only valid for desktop entries with the Link type.

KEY_FILE_DESKTOP_KEY_VERSION

A key under #G_KEY_FILE_DESKTOP_GROUP, whose value is a string giving the version of the Desktop Entry Specification used for the desktop entry file.

KEY_FILE_DESKTOP_TYPE_APPLICATION

The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop entries representing applications.

KEY_FILE_DESKTOP_TYPE_DIRECTORY

The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop entries representing directories.

KEY_FILE_DESKTOP_TYPE_LINK

The value of the #G_KEY_FILE_DESKTOP_KEY_TYPE, key for desktop entries representing links to documents.

LITTLE_ENDIAN

Specifies one of the possible types of byte order. See #G_BYTE_ORDER.

LN10

The natural logarithm of 10.

LN2

The natural logarithm of 2.

LOG_2_BASE_10

Multiplying the base 2 exponent by this number yields the base 10 exponent.

LOG_DOMAIN

Defines the log domain. See Log Domains.

LOG_FATAL_MASK

GLib log levels that are considered fatal by default.

LOG_LEVEL_USER_SHIFT

Log levels below 1<<G_LOG_LEVEL_USER_SHIFT are used by GLib. Higher bits can be used for user-defined log levels.

MAJOR_VERSION

The major version number of the GLib library.

MAXINT16

The maximum value which can be held in a #gint16.

MAXINT32

The maximum value which can be held in a #gint32.

MAXINT64

The maximum value which can be held in a #gint64.

MAXINT8

The maximum value which can be held in a #gint8.

MAXUINT16

The maximum value which can be held in a #guint16.

MAXUINT32

The maximum value which can be held in a #guint32.

MAXUINT64

The maximum value which can be held in a #guint64.

MAXUINT8

The maximum value which can be held in a #guint8.

MICRO_VERSION

The micro version number of the GLib library.

MININT16

The minimum value which can be held in a #gint16.

MININT32

The minimum value which can be held in a #gint32.

MININT64

The minimum value which can be held in a #gint64.

MININT8

The minimum value which can be held in a #gint8.

MINOR_VERSION

The minor version number of the GLib library.

MODULE_SUFFIX
OPTION_REMAINING

If a long option in the main group has this name, it is not treated as a regular option. Instead it collects all non-option arguments which would otherwise be left in argv. The option must be of type G_OPTION_ARG_CALLBACK, G_OPTION_ARG_STRING_ARRAY or G_OPTION_ARG_FILENAME_ARRAY.

PDP_ENDIAN

Specifies one of the possible types of byte order (currently unused). See #G_BYTE_ORDER.

PI

The value of pi (ratio of circle’s circumference to its diameter).

PI_2

Pi divided by 2.

PI_4

Pi divided by 4.

PID_FORMAT

A format specifier that can be used in printf()-style format strings when printing a GPid.

POLLFD_FORMAT

A format specifier that can be used in printf()-style format strings when printing the fd member of a GPollFD.

PRIORITY_DEFAULT

Use this for default priority event sources.

PRIORITY_DEFAULT_IDLE

Use this for default priority idle functions.

PRIORITY_HIGH

Use this for high priority event sources.

PRIORITY_HIGH_IDLE

Use this for high priority idle functions.

PRIORITY_LOW

Use this for very low priority background tasks.

SEARCHPATH_SEPARATOR

The search path separator character. This is ‘:’ on UNIX machines and ‘;’ under Windows.

SEARCHPATH_SEPARATOR_S

The search path separator as a string. This is “:” on UNIX machines and “;” under Windows.

SIZEOF_LONG
SIZEOF_SIZE_T
SIZEOF_SSIZE_T
SIZEOF_VOID_P
SOURCE_CONTINUE

Use this macro as the return value of a GSourceFunc to leave the GSource in the main loop.

SOURCE_REMOVE

Use this macro as the return value of a GSourceFunc to remove the GSource from the main loop.

SQRT2

The square root of two.

STR_DELIMITERS

The standard delimiters, used in g_strdelimit().

SYSDEF_AF_INET
SYSDEF_AF_INET6
SYSDEF_AF_UNIX
SYSDEF_MSG_DONTROUTE
SYSDEF_MSG_OOB
SYSDEF_MSG_PEEK
TEST_OPTION_ISOLATE_DIRS

Creates a unique temporary directory for each unit test and uses g_set_user_dirs() to set XDG directories to point into subdirectories of it for the duration of the unit test. The directory tree is cleaned up after the test finishes successfully. Note that this doesn’t take effect until g_test_run() is called, so calls to (for example) g_get_user_home_dir() will return the system-wide value when made in a test program’s main() function.

TIME_SPAN_DAY

Evaluates to a time span of one day.

TIME_SPAN_HOUR

Evaluates to a time span of one hour.

TIME_SPAN_MILLISECOND

Evaluates to a time span of one millisecond.

TIME_SPAN_MINUTE

Evaluates to a time span of one minute.

TIME_SPAN_SECOND

Evaluates to a time span of one second.

UNICHAR_MAX_DECOMPOSITION_LENGTH

The maximum length (in codepoints) of a compatibility or canonical decomposition of a single Unicode character.

URI_RESERVED_CHARS_GENERIC_DELIMITERS

Generic delimiters characters as defined in RFC 3986. Includes :/?#[]@.

URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS

Subcomponent delimiter characters as defined in RFC 3986. Includes !$&'()*+,;=.

USEC_PER_SEC

Number of microseconds in one second (1 million). This macro is provided for code readability.

VA_COPY_AS_ARRAY
VERSION_MIN_REQUIRED

A macro that should be defined by the user prior to including the glib.h header. The definition should be one of the predefined GLib version macros: GLIB_VERSION_2_26, GLIB_VERSION_2_28,…

WIN32_MSG_HANDLE