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.
since: 2.8
aligned_allocThis function is similar to g_malloc(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to align the allocated memory to with the given alignment value. Additionally, it will detect possible overflow during multiplication.
since: 2.72
aligned_alloc0This function is similar to g_aligned_alloc(), but it will also clear the allocated memory before returning it.
since: 2.72
aligned_freeFrees the memory allocated by g_aligned_alloc().
since: 2.72
aligned_free_sizedFrees the memory pointed to by mem
, assuming it is has the given size
and alignment
.
since: 2.76
ascii_digit_valueDetermines the numeric value of a character as a decimal digit. If the character is not a decimal digit according to g_ascii_isdigit()
, -1
is returned.
Converts a gdouble
to a string, using the ‘.’ as decimal point.
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’.
Compare two strings, ignoring the case of ASCII characters.
ascii_strdownConverts all upper case ASCII letters to lower case ASCII letters, with semantics that exactly match g_ascii_tolower()
.
A convenience function for converting a string to a signed number.
since: 2.54
ascii_string_to_unsignedA convenience function for converting a string to an unsigned number.
since: 2.54
ascii_strncasecmpCompare s1
and s2
, ignoring the case of ASCII characters and any characters after the first n
in each string. If either string is less than n
bytes long, comparison will stop at the first nul byte encountered.
Converts a string to a floating point value.
ascii_strtollConverts a string to a gint64
value.
since: 2.12
ascii_strtoullConverts a string to a guint64
value.
since: 2.2
ascii_strupConverts all lower case ASCII letters to upper case ASCII letters, with semantics that exactly match g_ascii_toupper()
.
Convert a character to ASCII lower case. If the character is not an ASCII upper case letter, it is returned unchanged.
ascii_toupperConvert a character to ASCII upper case. If the character is not an ASCII lower case letter, it is returned unchanged.
ascii_xdigit_valueDetermines the numeric value of a character as a hexadecimal digit. If the character is not a hex digit according to g_ascii_isxdigit()
, -1
is returned.
Internal function used to print messages from the public g_assert()
and g_assert_not_reached()
macros.
Specifies a function to be called at normal program termination.
deprecated: 2.32
atomic_int_addAtomically adds val
to the value of atomic
.
since: 2.4
atomic_int_andPerforms an atomic bitwise ‘and’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_int_compare_and_exchangeCompares atomic
to oldval
and, if equal, sets it to newval
. If atomic
was not equal to oldval
then no change occurs.
since: 2.4
atomic_int_compare_and_exchange_fullCompares atomic
to oldval
and, if equal, sets it to newval
. If atomic
was not equal to oldval
then no change occurs. In any case the value of atomic
before this operation is stored in preval
.
since: 2.74
atomic_int_dec_and_testDecrements the value of atomic
by 1.
since: 2.4
atomic_int_exchangeSets the atomic
to newval
and returns the old value from atomic
.
since: 2.74
atomic_int_exchange_and_addThis 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.
deprecated: 2.30 since: 2.4
atomic_int_getGets the current value of atomic
.
since: 2.4
atomic_int_incIncrements the value of atomic
by 1.
since: 2.4
atomic_int_orPerforms an atomic bitwise ‘or’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_int_setSets the value of atomic
to newval
.
since: 2.4
atomic_int_xorPerforms an atomic bitwise ‘xor’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_pointer_addAtomically adds val
to the value of atomic
.
since: 2.30
atomic_pointer_andPerforms an atomic bitwise ‘and’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_pointer_compare_and_exchangeCompares atomic
to oldval
and, if equal, sets it to newval
. If atomic
was not equal to oldval
then no change occurs.
since: 2.4
atomic_pointer_compare_and_exchange_fullCompares atomic
to oldval
and, if equal, sets it to newval
. If atomic
was not equal to oldval
then no change occurs. In any case the value of atomic
before this operation is stored in preval
.
since: 2.74
atomic_pointer_exchangeSets the atomic
to newval
and returns the old value from atomic
.
since: 2.74
atomic_pointer_getGets the current value of atomic
.
since: 2.4
atomic_pointer_orPerforms an atomic bitwise ‘or’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_pointer_setSets the value of atomic
to newval
.
since: 2.4
atomic_pointer_xorPerforms an atomic bitwise ‘xor’ of the value of atomic
and val
, storing the result back in atomic
.
since: 2.30
atomic_rc_box_acquireAtomically acquires a reference on the data pointed by mem_block
.
since: 2.58
atomic_rc_box_allocAllocates block_size
bytes of memory, and adds atomic reference counting semantics to it.
since: 2.58
atomic_rc_box_alloc0Allocates block_size
bytes of memory, and adds atomic reference counting semantics to it.
since: 2.58
atomic_rc_box_dupAllocates a new block of data with atomic reference counting semantics, and copies block_size
bytes of mem_block
into it.
since: 2.58
atomic_rc_box_get_sizeRetrieves the size of the reference counted data pointed by mem_block
.
since: 2.58
atomic_rc_box_releaseAtomically releases a reference on the data pointed by mem_block
.
since: 2.58
atomic_rc_box_release_fullAtomically releases a reference on the data pointed by mem_block
.
since: 2.58
atomic_ref_count_compareAtomically compares the current value of arc
with val
.
since: 2.58
atomic_ref_count_decAtomically decreases the reference count.
since: 2.58
atomic_ref_count_incAtomically increases the reference count.
since: 2.58
atomic_ref_count_initInitializes a reference count variable to 1.
since: 2.58
base64_decodeDecode 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.
since: 2.12
base64_decode_inplaceDecode a sequence of Base-64 encoded text into binary data by overwriting the input data.
since: 2.20
base64_decode_stepIncrementally 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.
since: 2.12
base64_encodeEncode a sequence of binary data into its Base-64 stringified representation.
since: 2.12
base64_encode_closeFlush the status from a sequence of calls to g_base64_encode_step().
since: 2.12
base64_encode_stepIncrementally 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.
since: 2.12
basenameGets the name of the file without any leading directory components. It returns a pointer into the given file name string.
deprecated: 2.2
bit_lockSets the indicated lock_bit
in address
. If the bit is already set, this call will block until g_bit_unlock()
unsets the corresponding bit.
since: 2.24
bit_lock_and_getSets the indicated lock_bit
in address
and atomically returns the new value.
unstable since: 2.86
bit_nth_lsfFind 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.
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.
Gets the number of bits used to hold number
, e.g. if number
is 4, 3 bits are needed.
Sets the indicated lock_bit
in address
, returning TRUE
if successful. If the bit is already set, returns FALSE
immediately.
since: 2.24
bit_unlockClears 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.
since: 2.24
bit_unlock_and_setThis is like g_bit_unlock()
but also atomically sets address
to val
.
unstable since: 2.86
blow_chunksdeprecated: 2.10
build_filenameCreates a filename from a series of elements using the correct separator for the current platform.
build_filename_valistCreates a filename from a list of elements using the correct separator for the current platform.
since: 2.56
build_filenamevCreates a filename from a vector of elements using the correct separator for the current platform.
since: 2.8
build_pathCreates a path from a series of elements using separator
as the separator between elements.
Behaves exactly like g_build_path(), but takes the path elements as a string array, instead of variadic arguments.
since: 2.8
canonicalize_filenameGets the canonical file name from filename
. All triple slashes are turned into single slashes, and all ..
and .
s resolved against relative_to
.
since: 2.58
chdirA wrapper for the POSIX chdir()
function. The function changes the current directory of the process to path
.
since: 2.8
check_versionChecks that the GLib library in use is compatible with the given version.
since: 2.6
child_watch_addSets a function to be called when the child indicated by pid
exits, at a default priority, G_PRIORITY_DEFAULT
.
since: 2.4
child_watch_add_fullSets a function to be called when the child indicated by pid
exits, at the priority priority
.
since: 2.4
child_watch_source_newCreates a new child_watch source.
since: 2.4
chmodA wrapper for the POSIX chmod()
function. The chmod()
function is used to set the permissions of a file system object.
since: 2.8
clear_errorIf err
or *err
is NULL
, does nothing. Otherwise, calls g_error_free()
on *err
and sets *err
to NULL
.
If fd_ptr
points to a file descriptor, close it and return whether closing it was successful, like g_close(). If fd_ptr
points to a negative number, return TRUE
without closing anything. In both cases, set fd_ptr
to -1
before returning.
since: 2.76
clear_handle_idClears a numeric handler, such as a GSource
ID.
since: 2.56
clear_listClears a pointer to a GList
, freeing it and, optionally, freeing its elements using destroy
.
since: 2.64
clear_pointerClears a reference to a variable.
since: 2.34
clear_slistClears a pointer to a GSList
, freeing it and, optionally, freeing its elements using destroy
.
since: 2.64
closeThis wraps the close()
call. In case of error, %errno will be preserved, but the error will also be stored as a GError
in error
. In case of success, %errno is undefined.
since: 2.36
closefromClose every file descriptor equal to or greater than lowfd
.
since: 2.80
compute_checksum_for_bytesComputes the checksum for a binary data
. This is a convenience wrapper for g_checksum_new(), g_checksum_get_string()
and g_checksum_free().
since: 2.34
compute_checksum_for_dataComputes 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().
since: 2.16
compute_checksum_for_stringComputes the checksum of a string.
since: 2.16
compute_hmac_for_bytesComputes the HMAC for a binary data
. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string()
and g_hmac_unref().
since: 2.50
compute_hmac_for_dataComputes 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().
since: 2.30
compute_hmac_for_stringComputes the HMAC for a string.
since: 2.30
convertConverts a string from one character set to another.
convert_error_quark convert_with_fallbackConverts 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.
Converts a string from one character set to another.
creatA wrapper for the POSIX creat()
function. The creat()
function is used to convert a pathname into a file descriptor, creating a file if necessary.
since: 2.8
datalist_clearFrees all the data elements of the datalist. The data elements’ destroy functions are called if they have been set.
datalist_foreachCalls 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.
Gets a data element, using its string identifier. This is slower than g_datalist_id_get_data()
because it compares strings.
Gets flags values packed in together with the datalist. See g_datalist_set_flags().
since: 2.8
datalist_id_dup_dataThis 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.
since: 2.34
datalist_id_get_dataRetrieves the data element corresponding to key_id
.
Removes multiple keys from a datalist.
since: 2.74
datalist_id_remove_no_notifyRemoves an element, without calling its destroy notification function.
datalist_id_replace_dataCompares the member that is associated with key_id
in datalist
to oldval
, and if they are the same, replace oldval
with newval
.
since: 2.34
datalist_id_set_data_fullSets 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.
Resets the datalist to NULL
. It does not free any memory or call any destroy functions.
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.).
since: 2.8
datalist_unset_flagsTurns off flag values for a data list. See g_datalist_unset_flags().
since: 2.8
dataset_destroyDestroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements.
dataset_foreachCalls 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.
Gets the data element corresponding to a GQuark
.
Removes an element, without calling its destroy notification function.
dataset_id_set_data_fullSets 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.
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.
since: 2.26
dgettextThis 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.
since: 2.18
direct_equalCompares 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
.
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
.
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.
since: 2.18
double_equalCompares 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
.
since: 2.22
double_hashConverts 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
.
since: 2.22
dpgettextThis 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.
since: 2.16
dpgettext2This 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
.
since: 2.18
environ_getenvReturns the value of the environment variable variable
in the provided list envp
.
since: 2.32
environ_setenvSets the environment variable variable
in the provided list envp
to value
.
since: 2.32
environ_unsetenvRemoves the environment variable variable
from the provided environment envp
.
since: 2.32
fdwalk_set_cloexecMark every file descriptor equal to or greater than lowfd
to be closed at the next execve()
or similar, as if via the FD_CLOEXEC
flag.
since: 2.80
file_error_from_errnoGets a GFileError
constant based on the passed-in err_no
.
Reads an entire file into allocated memory, with good error checking.
file_open_tmpOpens a file for writing in the preferred directory for temporary files (as returned by g_get_tmp_dir()).
file_read_linkReads the contents of the symbolic link filename
like the POSIX readlink()
function.
since: 2.4
file_set_contentsWrites 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
.
since: 2.8
file_set_contents_fullWrites all of contents
to a file named filename
, with good error checking. If a file called filename
already exists it will be overwritten.
since: 2.66
file_testReturns 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.
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.
since: 2.6
filename_display_nameConverts 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.
since: 2.6
filename_from_uriConverts an escaped ASCII-encoded URI to a local filename in the encoding used for filenames.
filename_from_utf8Converts 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.
filename_to_uriConverts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.
filename_to_utf8Converts 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.
find_program_in_pathLocates 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.
A wrapper for the stdio fopen()
function. The fopen()
function opens a file and associates a new stream with it.
since: 2.6
format_sizeFormats 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.
since: 2.30
format_size_for_displayFormats 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”.
deprecated: 2.30 since: 2.16
format_size_fullFormats a size.
since: 2.30
fprintfAn implementation of the standard fprintf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
freeFrees the memory pointed to by mem
.
Frees the memory pointed to by mem
, assuming it is has the given size
.
since: 2.76
freopenA wrapper for the POSIX freopen()
function. The freopen()
function opens a file and associates it with an existing stream.
since: 2.6
fsyncA wrapper for the POSIX fsync()
function. On Windows, _commit()
will be used. On macOS, fcntl(F_FULLFSYNC)
will be used. The fsync()
function is used to synchronize a file’s in-core state with that of the disk.
since: 2.64
get_application_nameGets 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).
since: 2.2
get_charsetObtains the character set for the current locale; 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.).
Gets the character set for the current locale.
get_console_charsetObtains the character set used by the console attached to the process, which is suitable for printing output to the terminal.
since: 2.62
get_current_dirGets the current directory.
get_current_timeEquivalent to the UNIX gettimeofday()
function, but portable.
deprecated: 2.62
get_environGets the list of environment variables for the current process.
since: 2.28
get_filename_charsetsDetermines 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().
since: 2.6
get_home_dirGets the current user’s home directory.
get_host_nameReturn a name for the machine.
since: 2.8
get_language_namesComputes 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”.
since: 2.6
get_language_names_with_categoryComputes 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”.
since: 2.58
get_locale_variantsReturns 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.
since: 2.28
get_monotonic_timeQueries the system monotonic time.
since: 2.28
get_num_processorsDetermine 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.
since: 2.36
get_os_infoGet information about the operating system.
since: 2.64
get_prgnameGets the name of the program. This name should not be localized, in contrast to g_get_application_name().
get_real_nameGets 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.
Queries the system wall-clock time.
since: 2.28
get_system_config_dirsReturns an ordered list of base directories in which to access system-wide configuration information.
since: 2.6
get_system_data_dirsReturns an ordered list of base directories in which to access system-wide application data.
since: 2.6
get_tmp_dirGets the directory to use for temporary files.
get_user_cache_dirReturns a base directory in which to store non-essential, cached data specific to particular user.
since: 2.6
get_user_config_dirReturns a base directory in which to store user-specific application configuration information such as user preferences and settings.
since: 2.6
get_user_data_dirReturns a base directory in which to access application data such as icons that is customized for a particular user.
since: 2.6
get_user_nameGets 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_dirReturns a directory that is unique to the current user on the local system.
since: 2.28
get_user_special_dirReturns the full path of a special directory using its logical id.
since: 2.14
get_user_state_dirReturns a base directory in which to store state files specific to particular user.
since: 2.72
getenvReturns the value of an environment variable.
hostname_is_ascii_encodedTests 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.
since: 2.22
hostname_is_ip_addressTests if hostname
is the string form of an IPv4 or IPv6 address. (Eg, “192.168.0.1”.).
since: 2.22
hostname_is_non_asciiTests 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.
since: 2.22
hostname_to_asciiConverts hostname
to its canonical ASCII form; an ASCII-only string containing no uppercase letters and not ending with a trailing dot.
since: 2.22
hostname_to_unicodeConverts 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.
since: 2.22
iconvSame as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.
idle_addAdds 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.
Adds a function to be called whenever there are no higher priority events pending.
idle_add_onceAdds 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
.
since: 2.74
idle_remove_by_dataRemoves the idle function with the given data.
idle_source_newCreates a new idle source.
int64_equalCompares 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
.
since: 2.22
int64_hashConverts a pointer to a #gint64 to a hash value.
since: 2.22
int_equalCompares 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
.
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
.
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.
since: 2.10
intern_stringReturns a canonical representation for string
. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp().
since: 2.10
io_add_watchAdds the GIOChannel
into the default main loop context with the default priority.
Adds the GIOChannel
into the default main loop context with the given priority.
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.
Gets the names of all variables set in the environment.
since: 2.8
locale_from_utf8Converts 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. On Windows this means the system codepage.
locale_to_utf8Converts 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 into a UTF-8 string.
logLogs an error or debugging message.
log_default_handlerThe default log handler set up by GLib; g_log_set_default_handler()
allows to install an alternate default log handler.
Gets the current fatal mask.
unstable since: 2.86
log_get_debug_enabledReturn whether debug output from the GLib logging system is enabled.
since: 2.72
log_remove_handlerRemoves the log handler.
log_set_always_fatalSets the message levels which are always fatal, in any log domain.
log_set_debug_enabledEnable or disable debug output from the GLib logging system for all domains.
since: 2.72
log_set_default_handlerInstalls a default log handler which is used if no log handler has been set for the particular log domain and log level combination.
since: 2.6
log_set_fatal_maskSets the log levels which are fatal in the given domain.
log_set_handlerSets the log handler for a domain and a set of log levels.
log_set_handler_fullLike g_log_set_handler()
, but takes a destroy notify for the user_data
.
since: 2.46
log_set_writer_funcSet a writer function which will be called to format and write out each log message.
since: 2.50
log_structuredLog a message with structured data.
since: 2.50
log_structured_arrayLog a message with structured data.
since: 2.50
log_structured_standard log_variantLog a message with structured data, accepting the data within a GVariant
.
since: 2.50
log_writer_defaultFormat a structured log message and output it to the default log destination for the platform.
since: 2.50
log_writer_default_set_debug_domainsReset the list of domains to be logged, that might be initially set by the G_MESSAGES_DEBUG
or DEBUG_INVOCATION
environment variables.
since: 2.80
log_writer_default_set_use_stderrConfigure whether the built-in log functions will output all log messages to stderr
.
since: 2.68
log_writer_default_would_dropCheck whether g_log_writer_default()
and g_log_default_handler()
would ignore a message with the given domain and level.
since: 2.68
log_writer_format_fieldsFormat a structured log message as a string suitable for outputting to the terminal (or elsewhere).
since: 2.50
log_writer_is_journaldCheck 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
).
since: 2.50
log_writer_journaldFormat a structured log message and send it to the systemd journal as a set of key–value pairs.
since: 2.50
log_writer_standard_streamsFormat a structured log message and print it to either stdout
or stderr
, depending on its log level.
since: 2.50
log_writer_supports_colorCheck whether the given output_fd
file descriptor supports ANSI color escape sequences.
since: 2.50
log_writer_syslogFormat a structured log message and send it to the syslog daemon. Only fields which are understood by this function are included in the formatted string which is printed.
since: 2.80
logvLogs an error or debugging message.
lstatA wrapper for the POSIX lstat()
function. The lstat()
function is like stat()
except that in the case of symbolic links, it returns information about the symbolic link itself and not the file that it refers to. If the system does not support symbolic links g_lstat()
is identical to g_stat().
since: 2.6
main_current_sourceReturns the currently firing source for this thread.
since: 2.12
main_depthReturns 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.
Allocates n_bytes
bytes of memory. If n_bytes
is 0 it returns NULL
.
Allocates n_bytes
bytes of memory, initialized to 0’s. If n_bytes
is 0 it returns NULL
.
This function is similar to g_malloc0(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to detect possible overflow during multiplication.
since: 2.24
malloc_nThis function is similar to g_malloc(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to detect possible overflow during multiplication.
since: 2.24
markup_collect_attributesCollects the attributes of the element from the data passed to the GMarkupParser
start_element function, dealing with common error conditions and supporting boolean values.
since: 2.16
markup_error_quark markup_escape_textEscapes 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_escapedFormats 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.
since: 2.4
markup_vprintf_escapedFormats 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().
since: 2.4
mem_is_system_mallocChecks 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.
deprecated: 2.46
mem_profileGLib 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.
deprecated: 2.46
mem_set_vtableThis 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.
deprecated: 2.46
memdupAllocates byte_size
bytes of memory, and copies byte_size
bytes into it from mem
. If mem
is NULL
it returns NULL
.
deprecated: 2.68
memdup2Allocates byte_size
bytes of memory, and copies byte_size
bytes into it from mem
. If mem
is NULL
it returns NULL
.
since: 2.68
mkdirA wrapper for the POSIX mkdir()
function. The mkdir()
function attempts to create a directory with the given name and permissions. The mode argument is ignored on Windows.
since: 2.6
mkdir_with_parentsCreate a directory if it doesn’t already exist. Create intermediate parent directories as needed, too.
since: 2.8
mkdtempCreates a temporary directory in the current directory.
since: 2.30
mkdtemp_fullCreates a temporary directory in the current directory.
since: 2.30
mkstempOpens a temporary file in the current directory.
mkstemp_fullOpens a temporary file in the current directory.
since: 2.22
nullify_pointerSet the pointer at the specified location to NULL
.
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.
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().
A wrapper for the POSIX open()
function. The open()
function is used to convert a pathname into a file descriptor.
since: 2.6
option_error_quark parse_debug_stringParses 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_basenameGets the last component of the filename.
path_get_dirnameGets the directory components of a file name. For example, the directory component of /usr/bin/test
is /usr/bin
. The directory component of /
is /
.
Returns TRUE
if the given file_name
is an absolute file name. Note that this is a somewhat vague concept on Windows.
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
.
Matches a string against a compiled pattern.
deprecated: 2.70
pattern_match_simpleMatches a string against a pattern given as a string.
pattern_match_stringMatches a string against a compiled pattern.
deprecated: 2.70
pointer_bit_lockThis is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).
since: 2.30
pointer_bit_lock_and_getThis is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).
since: 2.80
pointer_bit_lock_mask_ptrThis mangles ptr
as g_pointer_bit_lock()
and g_pointer_bit_unlock()
do.
since: 2.80
pointer_bit_trylockThis is equivalent to g_bit_trylock(), but working on pointers (or other pointer-sized values).
since: 2.30
pointer_bit_unlockThis is equivalent to g_bit_unlock, but working on pointers (or other pointer-sized values).
since: 2.30
pointer_bit_unlock_and_setThis is equivalent to g_pointer_bit_unlock()
and atomically setting the pointer value.
since: 2.80
pollPolls 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.
since: 2.20
prefix_errorFormats a string according to format
and prefix it to an existing error message. If err
is NULL
(ie: no error variable) then do nothing.
since: 2.16
prefix_error_literalPrefixes prefix
to an existing error message. If err
or *err
is NULL
(i.e.: no error variable) then do nothing.
since: 2.70
printOutputs a formatted message via the print handler.
printerrOutputs a formatted message via the error message handler.
printfAn implementation of the standard printf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
printf_string_upper_boundCalculates the maximum space needed to store the output of the sprintf()
function.
If dest
is NULL
, free src
; otherwise, moves src
into *dest
. The error variable dest
points to must be NULL
.
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().
since: 2.16
qsort_with_dataThis is just like the standard C qsort()
function, but the comparison routine accepts a user data argument (like qsort_r()
).
deprecated: 2.82
quark_from_static_stringGets 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.
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.
Gets the string associated with the given GQuark
.
Gets the GQuark
associated with the given string, or 0 if string is NULL
or it has no associated GQuark
.
Returns a random #gdouble equally distributed over the range [0..1).
random_double_rangeReturns a random #gdouble equally distributed over the range [begin
..end
).
Return a random #guint32 equally distributed over the range [0..2^32-1].
random_int_rangeReturns a random #gint32 equally distributed over the range [begin
..end
-1].
Sets the seed for the global random number generator, which is used by the g_random_* functions, to seed
.
Acquires a reference on the data pointed by mem_block
.
since: 2.58
rc_box_allocAllocates block_size
bytes of memory, and adds reference counting semantics to it.
since: 2.58
rc_box_alloc0Allocates block_size
bytes of memory, and adds reference counting semantics to it.
since: 2.58
rc_box_dupAllocates a new block of data with reference counting semantics, and copies block_size
bytes of mem_block
into it.
since: 2.58
rc_box_get_sizeRetrieves the size of the reference counted data pointed by mem_block
.
since: 2.58
rc_box_releaseReleases a reference on the data pointed by mem_block
.
since: 2.58
rc_box_release_fullReleases a reference on the data pointed by mem_block
.
since: 2.58
reallocReallocates 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
.
This function is similar to g_realloc(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to detect possible overflow during multiplication.
since: 2.24
ref_count_compareCompares the current value of rc
with val
.
since: 2.58
ref_count_decDecreases the reference count.
since: 2.58
ref_count_incIncreases the reference count.
since: 2.58
ref_count_initInitializes a reference count variable to 1.
since: 2.58
ref_string_acquireAcquires a reference on a string.
since: 2.58
ref_string_equalCompares two ref-counted strings for byte-by-byte equality.
since: 2.84
ref_string_lengthRetrieves the length of str
.
since: 2.58
ref_string_newCreates a new reference counted string and copies the contents of str
into it.
since: 2.58
ref_string_new_internCreates a new reference counted string and copies the content of str
into it.
since: 2.58
ref_string_new_lenCreates a new reference counted string and copies the contents of str
into it, up to len
bytes.
since: 2.58
ref_string_releaseReleases a reference on a string; if it was the last reference, the resources allocated by the string are freed as well.
since: 2.58
reload_user_special_dirs_cacheResets 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.
since: 2.22
removeA wrapper for the POSIX remove()
function. The remove()
function deletes a name from the filesystem.
since: 2.6
renameA wrapper for the POSIX rename()
function. The rename()
function renames a file, moving it between directories if required.
since: 2.6
return_if_fail_warningInternal function used to print messages from the public g_return_if_fail()
and g_return_val_if_fail()
macros.
A wrapper for the POSIX rmdir()
function. The rmdir()
function deletes a directory from the filesystem.
since: 2.6
set_application_nameSets 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.
since: 2.2
set_errorDoes nothing if err
is NULL
; if err
is non-NULL
, then *err
must be NULL
. A new GError
is created and assigned to *err
.
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.
since: 2.18
set_prgnameSets the name of the program. This name should not be localized, in contrast to g_set_application_name().
set_print_handlerSets the print handler to func
, or resets it to the default GLib handler if NULL
.
Sets the handler for printing error messages to func
, or resets it to the default GLib handler if NULL
.
Updates a pointer to a string to a copy of new_str
and returns whether the string was changed.
since: 2.76
setenvSets 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.
since: 2.4
shell_error_quark shell_parse_argvParses 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).
shell_quoteQuotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string
.
Unquotes a string as the shell (/bin/sh) would.
slice_allocAllocates a block of memory from the libc allocator.
since: 2.10
slice_alloc0Allocates a block of memory via g_slice_alloc()
and initializes the returned memory to 0.
since: 2.10
slice_copyAllocates a block of memory from the slice allocator and copies block_size
bytes into it from mem_block
.
since: 2.14
slice_free1Frees a block of memory.
since: 2.10
slice_free_chain_with_offsetFrees a linked list of memory blocks of structure type type
.
since: 2.10
slice_get_config slice_get_config_state slice_set_config snprintfA 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.
This is just like the standard C qsort()
function, but the comparison routine accepts a user data argument (like qsort_r()
).
since: 2.82
spaced_primes_closestGets 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
.
Executes a child program asynchronously.
spawn_async_with_fdsExecutes a child program asynchronously.
since: 2.58
spawn_async_with_pipesIdentical to g_spawn_async_with_pipes_and_fds()
but with n_fds
set to zero, so no FD assignments are used.
Executes a child program asynchronously (your program will not block waiting for the child to exit).
since: 2.68
spawn_check_exit_statusAn old name for g_spawn_check_wait_status(), deprecated because its name is misleading.
deprecated: 2.70 since: 2.34
spawn_check_wait_statusSet error
if wait_status
indicates the child exited abnormally (e.g. with a nonzero exit code, or via a fatal signal).
since: 2.70
spawn_close_pidOn 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.
A simple version of g_spawn_async()
that parses a command line with g_shell_parse_argv()
and passes it to g_spawn_async().
A simple version of g_spawn_sync()
with little-used parameters removed, taking a command line instead of an argument vector.
Executes a child synchronously (waits for the child to exit before returning).
sprintfAn implementation of the standard sprintf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
statA wrapper for the POSIX stat()
function. The stat()
function returns information about a file. On Windows the stat()
function in the C library checks only the FAT-style READONLY attribute and does not look at the ACL at all. Thus on Windows the protection bits in the st_mode
field are a fabrication of little use.
since: 2.6
steal_fdSets fd_ptr
to -1
, returning the value that was there before.
since: 2.70
steal_handle_idSets handle_pointer
to 0
, returning the value that was there before.
since: 2.84
steal_pointerSets pp
to NULL
, returning the value that was there before.
since: 2.44
stpcpyCopies a nul-terminated string into the destination buffer, including the trailing nul byte, and returns a pointer to the trailing nul byte in dest
. The return value is useful for concatenating multiple strings without having to repeatedly scan for the end.
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
.
Looks whether the string str
begins with prefix
.
since: 2.2
str_has_suffixLooks whether a string ends with suffix
.
since: 2.2
str_hashConverts a string to a hash value.
str_is_asciiDetermines if a string is pure ASCII. A string is pure ASCII if it contains no bytes with the high bit set.
since: 2.40
str_match_stringChecks if a search conducted for search_term
should match potential_hit
.
since: 2.40
str_to_asciiTransliterate str
to plain ASCII.
since: 2.40
str_tokenize_and_foldTokenizes string
and performs folding on each token.
since: 2.40
strcanonFor each character in string
, if the character is not in valid_chars
, replaces the character with substitutor
.
A case-insensitive string comparison, corresponding to the standard strcasecmp()
function on platforms which support it.
deprecated: 2.2
strchompRemoves trailing whitespace from a string.
strchugRemoves leading whitespace from a string, by moving the rest of the characters forward.
strcmp0Compares str1
and str2
like strcmp()
.
since: 2.16
strcompressMakes a copy of a string replacing C string-style escape sequences with their one byte equivalent:.
strconcatConcatenates all of the given strings into one long string.
strdelimitConverts any delimiter characters in string
to new_delimiter
.
Converts a string to lower case.
deprecated: 2.2
strdupDuplicates a string. If str
is NULL
it returns NULL
.
Similar to the standard C sprintf()
function but safer, since it calculates the maximum space required and allocates memory to hold the result.
Similar to the standard C vsprintf()
function but safer, since it calculates the maximum space required and allocates memory to hold the result.
Copies an array of strings. The copy is a deep copy; each string is also copied.
strerrorReturns a string corresponding to the given error code, e.g. “no such process”.
strescapeIt replaces the following special characters in the string source
with their corresponding C escape sequence:.
Frees an array of strings, as well as each string it contains.
strip_contextAn auxiliary function for gettext()
support (see Q_()).
since: 2.4
strjoinJoins a number of strings together to form one long string, with the optional separator
inserted between each of them.
Joins an array of strings together to form one long string, with the optional separator
inserted between each of them.
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
.
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.
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.
deprecated: 2.2
strndupDuplicates 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
.
Creates a new string length
bytes long filled with fill_char
.
Reverses all of the bytes in a string. For example, g_strreverse ("abcdef")
will result in “fedcba”.
Searches the string haystack
for the last occurrence of the string needle
.
Searches the string haystack
for the last occurrence of the string needle
, limiting the length of the search to haystack_len
.
Returns a string describing the given signal, e.g. “Segmentation fault”. If the signal is unknown, it returns “unknown signal (<signum>)”.
strsplitSplits 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.
Splits string
into a number of tokens not containing any of the characters in delimiters
. 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.
since: 2.4
strstr_lenSearches the string haystack
for the first occurrence of the string needle
, limiting the length of the search to haystack_len
or a nul terminator byte (whichever is reached first).
Converts a string to a floating point value.
strupConverts a string to upper case.
deprecated: 2.2
strv_containsChecks if an array of strings contains the string str
according to g_str_equal()
. strv
must not be NULL
.
since: 2.44
strv_equalChecks if two arrays of strings contain exactly the same elements in exactly the same order.
since: 2.60
strv_get_type strv_lengthReturns the length of an array of strings. str_array
must not be NULL
.
since: 2.6
test_add_data_funcCreates a new test case.
since: 2.16
test_add_data_func_fullCreates a new test case.
since: 2.34
test_add_funcCreates a new test case.
since: 2.16
test_add_vtable test_bugAdds a message to test reports that associates a bug URI with a test case.
since: 2.16
test_bug_baseSpecifies the base URI for bug reports.
since: 2.16
test_build_filenameCreates the pathname to a data file that is required for a test.
since: 2.38
test_create_caseCreates a new GTestCase
.
since: 2.16
test_create_suiteCreates a new test suite with the name suite_name
.
since: 2.16
test_disable_crash_reportingAttempts to disable system crash reporting infrastructure.
since: 2.78
test_expect_messageIndicates that a message with the given log_domain
and log_level
, with text matching pattern
, is expected to be logged.
since: 2.34
test_failIndicates that a test failed.
since: 2.30
test_fail_printfIndicates that a test failed and records a message.
since: 2.70
test_failedReturns whether a test has already failed.
since: 2.38
test_get_dirGets the pathname of the directory containing test files of the type specified by file_type
.
since: 2.38
test_get_filenameGets the pathname to a data file that is required for a test.
since: 2.38
test_get_pathGets the test path for the test currently being run.
since: 2.68
test_get_rootGets the toplevel test suite for the test path API.
since: 2.16
test_incompleteIndicates that a test failed because of some incomplete functionality.
since: 2.38
test_incomplete_printfIndicates that a test failed because of some incomplete functionality.
since: 2.70
test_initInitializes the GLib testing framework.
since: 2.16
test_log_set_fatal_handlerInstalls a non-error fatal log handler which can be used to decide whether log messages which are counted as fatal abort the program.
since: 2.22
test_log_type_name test_maximized_resultReports the result of a performance or measurement test.
since: 2.16
test_messageAdds a message to the test report.
since: 2.16
test_minimized_resultReports the result of a performance or measurement test.
since: 2.16
test_queue_destroyEnqueues a callback destroy_func
to be executed during the next test case teardown phase.
since: 2.16
test_queue_freeEnqueues a pointer to be released with g_free()
during the next teardown phase.
since: 2.16
test_rand_doubleGets a reproducible random floating point number.
since: 2.16
test_rand_double_rangeGets a reproducible random floating point number out of a specified range.
since: 2.16
test_rand_intGets a reproducible random integer number.
since: 2.16
test_rand_int_rangeGets a reproducible random integer number out of a specified range.
since: 2.16
test_runRuns all tests under the toplevel suite.
since: 2.16
test_run_suiteExecutes the tests within suite
and all nested test suites.
since: 2.16
test_set_nonfatal_assertionsChanges the behaviour of the various assertion macros.
since: 2.38
test_skipIndicates that a test was skipped.
since: 2.38
test_skip_printfIndicates that a test was skipped.
since: 2.70
test_subprocessReturns true if the test program is running under g_test_trap_subprocess()
.
since: 2.38
test_summarySets the summary for a test.
since: 2.62
test_timer_elapsedGets the number of seconds since the last start of the timer with g_test_timer_start()
.
since: 2.16
test_timer_lastReports the last result of g_test_timer_elapsed()
.
since: 2.16
test_timer_startStarts a timing test.
since: 2.16
test_trap_assertions test_trap_forkForks the current test program to execute a test case that might not return or that might abort.
deprecated: Unknown since: 2.16
test_trap_has_passedChecks the result of the last g_test_trap_subprocess()
call.
since: 2.16
test_trap_reached_timeoutChecks the result of the last g_test_trap_subprocess()
call.
since: 2.16
test_trap_subprocessRespawns the test program to run only test_path
in a subprocess.
since: 2.38
test_trap_subprocess_with_envpRespawns the test program to run only test_path
in a subprocess with a given environment.
since: 2.80
timeout_addSets a function to be called at regular intervals, with the default priority, G_PRIORITY_DEFAULT
.
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
.
Sets a function to be called after interval
milliseconds have elapsed, with the default priority, G_PRIORITY_DEFAULT
.
since: 2.74
timeout_add_secondsSets a function to be called at regular intervals with the default priority, G_PRIORITY_DEFAULT
.
since: 2.14
timeout_add_seconds_fullSets a function to be called at regular intervals, with priority
.
since: 2.14
timeout_add_seconds_onceThis function behaves like g_timeout_add_once()
but with a range in seconds.
since: 2.78
timeout_source_newCreates a new timeout source.
timeout_source_new_secondsCreates a new timeout source.
since: 2.14
try_mallocAttempts to allocate n_bytes
, and returns NULL
on failure. Contrast with g_malloc(), which aborts the program on failure.
Attempts to allocate n_bytes
, initialized to 0’s, and returns NULL
on failure. Contrast with g_malloc0(), which aborts the program on failure.
since: 2.8
try_malloc0_nThis function is similar to g_try_malloc0(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to detect possible overflow during multiplication.
since: 2.24
try_malloc_nThis function is similar to g_try_malloc(), allocating (n_blocks
* n_block_bytes
) bytes, but care is taken to detect possible overflow during multiplication.
since: 2.24
try_reallocAttempts to realloc mem
to a new size, n_bytes
, and returns NULL
on failure. Contrast with g_realloc(), which aborts the program on failure.
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.
since: 2.24
ucs4_to_utf16Convert a string from UCS-4 to UTF-16.
ucs4_to_utf8Convert a string from a 32-bit fixed width representation as UCS-4. to UTF-8.
unichar_break_typeDetermines 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.
Determines the canonical combining class of a Unicode character.
since: 2.14
unichar_composePerforms a single composition step of the Unicode canonical composition algorithm.
since: 2.30
unichar_decomposePerforms a single decomposition step of the Unicode canonical decomposition algorithm.
since: 2.30
unichar_digit_valueDetermines the numeric value of a character as a decimal digit.
unichar_fully_decomposeComputes the canonical or compatibility decomposition of a Unicode character. For compatibility decomposition, pass TRUE
for compat
; for canonical decomposition pass FALSE
for compat
.
since: 2.30
unichar_get_mirror_charIn 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.
since: 2.4
unichar_get_scriptLooks 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.
since: 2.14
unichar_isalnumDetermines whether a character is alphanumeric. Given some UTF-8 text, obtain a character value with g_utf8_get_char().
unichar_isalphaDetermines whether a character is alphabetic (i.e. a letter). Given some UTF-8 text, obtain a character value with g_utf8_get_char().
unichar_iscntrlDetermines whether a character is a control character. Given some UTF-8 text, obtain a character value with g_utf8_get_char().
unichar_isdefinedDetermines if a given character is assigned in the Unicode standard.
unichar_isdigitDetermines 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_isgraphDetermines 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().
Determines whether a character is a lowercase letter. Given some UTF-8 text, obtain a character value with g_utf8_get_char().
unichar_ismarkDetermines 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().
since: 2.14
unichar_isprintDetermines 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().
Determines whether a character is punctuation or a symbol. Given some UTF-8 text, obtain a character value with g_utf8_get_char().
unichar_isspaceDetermines 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_istitleDetermines 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_isupperDetermines if a character is uppercase.
unichar_iswideDetermines if a character is typically rendered in a double-width cell.
unichar_iswide_cjkDetermines 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.
since: 2.12
unichar_isxdigitDetermines if a character is a hexadecimal digit.
unichar_iszerowidthDetermines 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.
since: 2.14
unichar_to_utf8Converts a single character to UTF-8.
unichar_tolowerConverts a character to lower case.
unichar_totitleConverts a character to the titlecase.
unichar_toupperConverts a character to uppercase.
unichar_typeClassifies a Unicode character by type.
unichar_validateChecks whether ch
is a valid Unicode character.
Determines the numeric value of a character as a hexadecimal digit.
unicode_canonical_decompositionComputes the canonical decomposition of a Unicode character.
deprecated: 2.30
unicode_canonical_orderingComputes 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.
unlinkA 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.
since: 2.6
unsetenvRemoves an environment variable from the environment.
since: 2.4
usleepPauses the current thread for the given number of microseconds.
utf16_to_ucs4Convert a string from UTF-16 to UCS-4.
utf16_to_utf8Convert a string from UTF-16 to UTF-8.
utf8_casefoldConverts 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.
Compares two strings for ordering using the linguistically correct rules for the current locale. 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.
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_filenameConverts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().
since: 2.8
utf8_find_next_charFinds the start of the next UTF-8 character in the string after p
.
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
.
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
utf8_get_char_validatedConvert a sequence of bytes encoded as UTF-8 to a Unicode character.
utf8_make_validIf 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).
since: 2.52
utf8_normalizeConverts 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.
Converts from an integer character offset to a pointer to a position within the string.
utf8_pointer_to_offsetConverts from a pointer to position within a string to an integer character offset.
utf8_prev_charFinds the previous UTF-8 character in the string before p
.
Finds the leftmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len
bytes.
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_strlenComputes the length of the string in characters, not including the terminating nul character. If the max
’th byte falls in the middle of a character, the last (partial) character is not counted.
Like the standard C strncpy()
function, but copies a given number of characters instead of a given number of bytes.
Find the rightmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len
bytes.
Reverses a UTF-8 string.
since: 2.2
utf8_strupConverts 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_substringCopies a substring out of a UTF-8 encoded string. The substring will contain end_pos
- start_pos
characters.
since: 2.30
utf8_to_ucs4Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4.
utf8_to_ucs4_fastConvert a string from UTF-8 to a 32-bit fixed width representation as UCS-4, assuming valid UTF-8 input.
utf8_to_utf16Convert a string from UTF-8 to UTF-16.
utf8_truncate_middleCuts off the middle of the string, preserving half of truncate_length
characters at the beginning and half at the end.
since: 2.78
utf8_validateValidates UTF-8 encoded text.
utf8_validate_lenValidates UTF-8 encoded text.
since: 2.60
utimeA wrapper for the POSIX utime()
function. The utime()
function sets the access and modification timestamps of a file.
since: 2.18
uuid_string_is_validParses the string str
and verify if it is a UUID.
since: 2.52
uuid_string_randomGenerates 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.
since: 2.52
variant_get_gtype vasprintfAn 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.
since: 2.4
vfprintfAn implementation of the standard fprintf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
vprintfAn implementation of the standard vprintf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
vsnprintfA 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.
An implementation of the standard vsprintf()
function which supports positional parameters, as specified in the Single Unix Specification.
since: 2.2
warn_messageInternal function used to print messages from the public g_warn_if_reached()
and g_warn_if_fail()
macros.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4