From f32efe5b21da6b89b46d89247588e2469fe41fd2 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 12 Mar 2023 15:18:21 +0100 Subject: Glib, Gio: Regenerate docs.xml and .defs files using glib files from glib 2.76.0. --- gio/src/gio_docs.xml | 97 +++++- glib/src/glib_docs.xml | 778 +++++++++++++++++++++++++++++++++++++------ glib/src/glib_functions.defs | 154 +++++++-- 3 files changed, 889 insertions(+), 140 deletions(-) diff --git a/gio/src/gio_docs.xml b/gio/src/gio_docs.xml index 4d2dfaf3..bf54c9d1 100644 --- a/gio/src/gio_docs.xml +++ b/gio/src/gio_docs.xml @@ -8976,6 +8976,10 @@ no display name is available. Gets the executable's name for the installed application. +This is intended to be used for debugging or labelling what program is going +to be run. To launch the executable, use g_app_info_launch() and related +functions, rather than spawning the return value from this function. + @@ -13559,8 +13563,8 @@ containing the data to convert. - a buffer to write -converted data in. + a +buffer to write converted data in. @@ -13572,11 +13576,13 @@ converted data in. - will be set to the number of bytes read from @inbuf on success + will be set to the number of bytes read +from @inbuf on success - will be set to the number of bytes written to @outbuf on success + will be set to the number of bytes +written to @outbuf on success @@ -25540,7 +25546,7 @@ will always return %TRUE. -Checks if a attribute matcher only matches a given attribute. Always +Checks if an attribute matcher only matches a given attribute. Always returns %FALSE if "*" was used when creating the matcher. @@ -27576,9 +27582,10 @@ Duplicates a file info structure. Gets the access time of the current @info and returns it as a #GDateTime. -This requires the %G_FILE_ATTRIBUTE_TIME_ACCESS attribute. If -%G_FILE_ATTRIBUTE_TIME_ACCESS_USEC is provided, the resulting #GDateTime -will have microsecond precision. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_TIME_ACCESS. If %G_FILE_ATTRIBUTE_TIME_ACCESS_USEC is +provided, the resulting #GDateTime will additionally have microsecond +precision. If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC must be queried separately using g_file_info_get_attribute_uint32(). @@ -27598,7 +27605,7 @@ Since: 2.70 -Gets the value of a attribute, formatted as a string. +Gets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8. @@ -27900,6 +27907,9 @@ attribute does not contain an unsigned 64-bit integer, or is invalid, Gets the file's content type. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE. + @@ -27918,9 +27928,10 @@ or %NULL if unknown. Gets the creation time of the current @info and returns it as a #GDateTime. -This requires the %G_FILE_ATTRIBUTE_TIME_CREATED attribute. If -%G_FILE_ATTRIBUTE_TIME_CREATED_USEC is provided, the resulting #GDateTime -will have microsecond precision. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_TIME_CREATED. If %G_FILE_ATTRIBUTE_TIME_CREATED_USEC is +provided, the resulting #GDateTime will additionally have microsecond +precision. If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_CREATED_NSEC must be queried separately using g_file_info_get_attribute_uint32(). @@ -27941,8 +27952,8 @@ Since: 2.70 Returns the #GDateTime representing the deletion date of the file, as -available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the -G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, %NULL is returned. +available in %G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the +%G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, %NULL is returned. Since: 2.36 @@ -27962,6 +27973,9 @@ Since: 2.36 Gets a display name for a file. This is guaranteed to always be set. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. + @@ -27978,6 +27992,9 @@ Gets a display name for a file. This is guaranteed to always be set. Gets the edit name for a file. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. + @@ -27995,6 +28012,9 @@ Gets the edit name for a file. Gets the [entity tag][gfile-etag] for a given #GFileInfo. See %G_FILE_ATTRIBUTE_ETAG_VALUE. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_ETAG_VALUE. + @@ -28012,6 +28032,9 @@ Gets the [entity tag][gfile-etag] for a given Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see g_file_info_get_content_type(). +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_TYPE. + @@ -28028,6 +28051,9 @@ This is different from the file's content type, see g_file_info_get_content_type Gets the icon for a file. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_ICON. + @@ -28044,6 +28070,9 @@ Gets the icon for a file. Checks if a file is a backup file. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP. + @@ -28060,6 +28089,9 @@ Checks if a file is a backup file. Checks if a file is hidden. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN. + @@ -28076,6 +28108,9 @@ Checks if a file is hidden. Checks if a file is a symlink. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. + @@ -28093,9 +28128,10 @@ Checks if a file is a symlink. Gets the modification time of the current @info and returns it as a #GDateTime. -This requires the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute. If -%G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting #GDateTime -will have microsecond precision. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_TIME_MODIFIED. If %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is +provided, the resulting #GDateTime will additionally have microsecond +precision. If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC must be queried separately using g_file_info_get_attribute_uint32(). @@ -28118,6 +28154,10 @@ Since: 2.62 Gets the modification time of the current @info and sets it in @result. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_TIME_MODIFIED. If %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is +provided it will be used too. + Deprecated: 2.62: Use g_file_info_get_modification_date_time() instead, as #GTimeVal is deprecated due to the year 2038 problem. @@ -28139,6 +28179,9 @@ Deprecated: 2.62: Use g_file_info_get_modification_date_time() instead, as Gets the name for a file. This is guaranteed to always be set. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_NAME. + @@ -28157,6 +28200,9 @@ Gets the file's size (in bytes). The size is retrieved through the value of the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from #guint64 to #goffset before returning the result. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_SIZE. + @@ -28174,6 +28220,9 @@ from #guint64 to #goffset before returning the result. Gets the value of the sort_order attribute from the #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. + @@ -28190,6 +28239,9 @@ See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. Gets the symbolic icon for a file. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. + Since: 2.34 @@ -28208,6 +28260,9 @@ Since: 2.34 Gets the symlink target for a given #GFileInfo. +It is an error to call this if the #GFileInfo does not contain +%G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET. + @@ -36372,6 +36427,10 @@ comparing them with @equal_func until the first occurrence of @item which matches. If @item was not found, then @position will not be set, and this method will return %FALSE. +@item is always passed as second parameter to @equal_func. + +Since GLib 2.76 it is possible to pass `NULL` for @item. + Since: 2.64 @@ -36404,6 +36463,10 @@ set to the position where @item occurred for the first time. Like g_list_store_find_with_equal_func() but with an additional @user_data that is passed to @equal_func. +@item is always passed as second parameter to @equal_func. + +Since GLib 2.76 it is possible to pass `NULL` for @item. + Since: 2.74 diff --git a/glib/src/glib_docs.xml b/glib/src/glib_docs.xml index c1813619..648a89de 100644 --- a/glib/src/glib_docs.xml +++ b/glib/src/glib_docs.xml @@ -4488,7 +4488,7 @@ If the allocation fails (because the system is out of memory), the program is terminated. Aligned memory allocations returned by this function can only be -freed using g_aligned_free(). +freed using g_aligned_free_sized() or g_aligned_free(). Since: 2.72 @@ -4557,6 +4557,38 @@ Since: 2.72 + + +Frees the memory pointed to by @mem, assuming it is has the given @size and +@alignment. + +If @mem is %NULL this is a no-op (and @size is ignored). + +It is an error if @size doesn’t match the size, or @alignment doesn’t match +the alignment, passed when @mem was allocated. @size and @alignment are +passed to this function to allow optimizations in the allocator. If you +don’t know either of them, use g_aligned_free() instead. + +Since: 2.76 + + + + + the memory to free + + + + alignment of @mem + + + + size of @mem, in bytes + + + + + + Allocates @size bytes on the stack; these bytes will be freed when the current @@ -4685,7 +4717,7 @@ result (if not, the function may produce false-negative). This example defines a comparison function and search an element in a #GArray: |[<!-- language="C" --> -static gint* +static gint cmpint (gconstpointer a, gconstpointer b) { const gint *_a = a; @@ -11133,7 +11165,7 @@ will create the appropriate `*_get_type()` function for the boxed type. Creates a filename from a series of elements using the correct -separator for filenames. +separator for the current platform. On Unix, this function behaves identically to `g_build_path (G_DIR_SEPARATOR_S, first_element, ....)`. @@ -11148,6 +11180,9 @@ No attempt is made to force the resulting filename to be an absolute path. If the first element is a relative path, the result will be a relative path. +If you are building a path programmatically you may want to use +#GPathBuf instead. + @@ -11160,15 +11195,20 @@ be a relative path. - a newly-allocated string that -must be freed with g_free(). + the newly allocated path +Creates a filename from a list of elements using the correct +separator for the current platform. + Behaves exactly like g_build_filename(), but takes the path elements -as a va_list. This function is mainly meant for language bindings. +as a va_list. + +This function is mainly meant for implementing other variadic arguments +functions. Since: 2.56 @@ -11183,18 +11223,23 @@ Since: 2.56 - a newly-allocated string that -must be freed with g_free(). + the newly allocated path -Behaves exactly like g_build_filename(), but takes the path elements -as a string array, instead of varargs. This function is mainly +Creates a filename from a vector of elements using the correct +separator for the current platform. + +This function 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. +If you are building a path programmatically you may want to use +#GPathBuf instead. + Since: 2.8 @@ -11205,8 +11250,7 @@ array of strings containing the path elements. - a newly-allocated string that -must be freed with g_free(). + the newly allocated path @@ -11214,10 +11258,12 @@ must be freed with g_free(). 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. +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. Empty elements are ignored. @@ -11256,16 +11302,16 @@ of the separator are ignored. - a newly-allocated string that -must be freed with g_free(). + the newly allocated path -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. +Behaves exactly like g_build_path(), but takes the path elements +as a string array, instead of variadic arguments. + +This function is mainly meant for language bindings. Since: 2.8 @@ -12290,6 +12336,7 @@ to use the current working directory a newly allocated string with the canonical file path + @@ -20702,14 +20749,15 @@ close(). In case of errors, -1 is returned and @error will be set. Reads the contents of the symbolic link @filename like the POSIX -readlink() function. +`readlink()` function. -The returned string is in the encoding used -for filenames. Use g_filename_to_utf8() to convert it to UTF-8. +The returned string is in the encoding used for filenames. Use +g_filename_to_utf8() to convert it to UTF-8. -The returned string may also be a relative path. Use g_build_filename() to -convert it to an absolute path: -|[ +The returned string may also be a relative path. Use g_build_filename() +to convert it to an absolute path: + +|[<!-- language="C" --> g_autoptr(GError) local_error = NULL; g_autofree gchar *link_target = g_file_read_link ("/etc/localtime", &local_error); @@ -20887,10 +20935,13 @@ Note, that for a dangling symbolic link g_file_test() will return You should never use g_file_test() to test whether it is safe to perform an operation, because there is always the possibility -of the condition changing before you actually perform the operation. +of the condition changing before you actually perform the operation, +see [TOCTOU](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use). + For example, you might think you could use %G_FILE_TEST_IS_SYMLINK to know whether it is safe to write to a file without being tricked into writing into a different location. It doesn't work! + |[<!-- language="C" --> // DON'T DO THIS if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) @@ -20898,6 +20949,21 @@ if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) fd = g_open (filename, O_WRONLY); // write to fd } + +// DO THIS INSTEAD +fd = g_open (filename, O_WRONLY | O_NOFOLLOW | O_CLOEXEC); +if (fd == -1) +{ +// check error +if (errno == ELOOP) +// file is a symlink and can be ignored +else +// handle errors as before +} +else +{ +// write to fd +} ]| Another thing to note is that %G_FILE_TEST_EXISTS and @@ -21538,6 +21604,9 @@ Since: 2.2 Frees the memory pointed to by @mem. +If you know the allocated size of @mem, calling g_free_sized() may be faster, +depending on the libc implementation in use. + If @mem is %NULL it simply returns, so there is no need to check @mem against %NULL before calling this function. @@ -21551,6 +21620,32 @@ against %NULL before calling this function. + + +Frees the memory pointed to by @mem, assuming it is has the given @size. + +If @mem is %NULL this is a no-op (and @size is ignored). + +It is an error if @size doesn’t match the size passed when @mem was +allocated. @size is passed to this function to allow optimizations in the +allocator. If you don’t know the allocation size, use g_free() instead. + +Since: 2.76 + + + + + the memory to free + + + + size of @mem, in bytes + + + + + + A wrapper for the POSIX freopen() function. The freopen() function @@ -21644,7 +21739,8 @@ used by the C library's current locale. On Linux, the character set is found by consulting nl_langinfo() if available. If not, the environment variables `LC_ALL`, `LC_CTYPE`, `LANG` -and `CHARSET` are queried in order. +and `CHARSET` are queried in order. nl_langinfo() returns the C locale if +no locale has been loaded by setlocale(). The return value is %TRUE if the locale's encoding is UTF-8, in that case you can perhaps avoid calling g_convert(). @@ -29352,11 +29448,15 @@ You must be the owner of a context before you can call g_main_context_prepare(), g_main_context_query(), g_main_context_check(), g_main_context_dispatch(). +Since 2.76 @context can be %NULL to use the global-default +main context. + - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29374,7 +29474,8 @@ a typical event source will use g_source_add_unix_fd() instead. - a #GMainContext (or %NULL for the default context) + a #GMainContext (or %NULL for the global-default +main context) @@ -29402,11 +29503,15 @@ on how @fds is filled. You must have successfully acquired the context with g_main_context_acquire() before you may call this function. +Since 2.76 @context can be %NULL to use the global-default +main context. + - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29429,7 +29534,7 @@ the last call to g_main_context_query() -Returns the global default main context. This is the main context +Returns the global-default main context. This is the main context used for main loop functions when a main loop is not explicitly specified, and corresponds to the "main" main loop. See also g_main_context_get_thread_default(). @@ -29438,7 +29543,7 @@ g_main_context_get_thread_default(). - the global default main context. + the global-default main context. @@ -29449,10 +29554,14 @@ Dispatches all pending sources. You must have successfully acquired the context with g_main_context_acquire() before you may call this function. +Since 2.76 @context can be %NULL to use the global-default +main context. + - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29469,7 +29578,8 @@ the first one found will be returned. - a #GMainContext (if %NULL, the default context will be used). + a #GMainContext (if %NULL, the global-default +main context will be used). @@ -29504,7 +29614,8 @@ wrong source. - a #GMainContext (if %NULL, the default context will be used) + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29526,7 +29637,8 @@ one found will be returned. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29546,7 +29658,8 @@ Gets the poll function set by g_main_context_set_poll_func(). - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29574,7 +29687,7 @@ Since: 2.22 the thread-default #GMainContext, or -%NULL if the thread-default context is the global default context. +%NULL if the thread-default context is the global-default main context. @@ -29584,7 +29697,7 @@ Since: 2.22 Invokes a function in such a way that @context is owned during the invocation of @function. -If @context is %NULL then the global default main context — as +If @context is %NULL then the global-default main context — as returned by g_main_context_default() — is used. If @context is owned by the current thread, @function is called @@ -29608,7 +29721,8 @@ Since: 2.28 - a #GMainContext, or %NULL + a #GMainContext, or %NULL for the global-default +main context @@ -29640,7 +29754,8 @@ Since: 2.28 - a #GMainContext, or %NULL + a #GMainContext, or %NULL for the global-default +main context @@ -29675,7 +29790,8 @@ Since: 2.10 - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29703,7 +29819,8 @@ be interrupted for other reasons than an event source becoming ready. - a #GMainContext (if %NULL, the default context will be used) + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29754,7 +29871,8 @@ Checks if any sources have pending events for the given context. - a #GMainContext (if %NULL, the default context will be used) + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29772,7 +29890,8 @@ Since: 2.22 - a #GMainContext object, or %NULL + a #GMainContext, or %NULL for the global-default +main context @@ -29791,7 +29910,8 @@ g_main_context_acquire() before you may call this function. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29812,7 +29932,7 @@ current thread. This will cause certain asynchronous operations (such as most [gio][gio]-based I/O) which are started in this thread to run under @context and deliver their results to its main loop, rather than running under the global -default context in the main thread. Note that calling this function +default main context in the main thread. Note that calling this function changes the context returned by g_main_context_get_thread_default(), not the one returned by g_main_context_default(), so it does not affect the context used by functions like g_idle_add(). @@ -29851,7 +29971,8 @@ Since: 2.22 - a #GMainContext, or %NULL for the global default context + a #GMainContext, or %NULL for the global-default +main context @@ -29945,7 +30066,8 @@ g_main_context_acquire() before you may call this function. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -29994,7 +30116,7 @@ Gets the thread-default #GMainContext for this thread, as with g_main_context_get_thread_default(), but also adds a reference to it with g_main_context_ref(). In addition, unlike g_main_context_get_thread_default(), if the thread-default context -is the global default context, this will return that #GMainContext +is the global-default context, this will return that #GMainContext (with a ref added to it) rather than returning %NULL. Since: 2.32 @@ -30018,7 +30140,8 @@ is called as many times as it was acquired. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -30033,7 +30156,8 @@ polled for a particular context. -a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -30057,7 +30181,8 @@ loop with an external event loop. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -30096,7 +30221,8 @@ Deprecated: 2.58: Use g_main_context_is_owner() and separate locking instead. - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -30147,7 +30273,8 @@ g_main_context_wakeup (NULL); - a #GMainContext + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -30375,7 +30502,8 @@ Creates a new #GMainLoop structure. - a #GMainContext (if %NULL, the default context will be used). + a #GMainContext (if %NULL, the global-default +main context will be used). @@ -38086,6 +38214,397 @@ strings with bit flags. + + +Clears the contents of the path buffer. + +This function should be use to free the resources in a stack-allocated +`GPathBuf` initialized using g_path_buf_init() or +g_path_buf_init_from_path(). + +Since: 2.76 + + + + + a path buffer + + + + + + + + +Clears the contents of the path buffer and returns the built path. + +This function returns `NULL` if the `GPathBuf` is empty. + +See also: g_path_buf_to_path() + +Since: 2.76 + + + + + a path buffer + + + + the built path + + + + + + +Copies the contents of a path buffer into a new `GPathBuf`. + +Since: 2.76 + + + + + a path buffer + + + + the newly allocated path buffer + + + + + + +Compares two path buffers for equality and returns `TRUE` +if they are equal. + +The path inside the paths buffers are not going to be normalized, +so `X/Y/Z/A/..`, `X/./Y/Z` and `X/Y/Z` are not going to be considered +equal. + +This function can be passed to g_hash_table_new() as the +`key_equal_func` parameter. + +Since: 2.76 + + + + + a path buffer to compare + + + + a path buffer to compare + + + + `TRUE` if the two path buffers are equal, +and `FALSE` otherwise + + + + + + +Frees a `GPathBuf` allocated by g_path_buf_new(). + +Since: 2.76 + + + + + a path buffer + + + + + + + + +Frees a `GPathBuf` allocated by g_path_buf_new(), and +returns the path inside the buffer. + +This function returns `NULL` if the `GPathBuf` is empty. + +See also: g_path_buf_to_path() + +Since: 2.76 + + + + + a path buffer + + + + the path + + + + + + +Initializes a `GPathBuf` instance. + +Since: 2.76 + + + + + a path buffer + + + + the initialized path builder + + + + + + +Initializes a `GPathBuf` instance with the given path. + +Since: 2.76 + + + + + a path buffer + + + + a file system path + + + + the initialized path builder + + + + + + +Allocates a new `GPathBuf`. + +Since: 2.76 + + + + + the newly allocated path buffer + + + + + + +Allocates a new `GPathBuf` with the given @path. + +Since: 2.76 + + + + + the path used to initialize the buffer + + + + the newly allocated path buffer + + + + + + +Removes the last element of the path buffer. + +If there is only one element in the path buffer (for example, `/` on +Unix-like operating systems or the drive on Windows systems), it will +not be removed and %FALSE will be returned instead. + +|[<!-- language="C" --> +GPathBuf buf, cmp; + +g_path_buf_init_from_path (&buf, "/bin/sh"); + +g_path_buf_pop (&buf); +g_path_buf_init_from_path (&cmp, "/bin"); +g_assert_true (g_path_buf_equal (&buf, &cmp)); +g_path_buf_clear (&cmp); + +g_path_buf_pop (&buf); +g_path_buf_init_from_path (&cmp, "/"); +g_assert_true (g_path_buf_equal (&buf, &cmp)); +g_path_buf_clear (&cmp); + +g_path_buf_clear (&buf); +]| + +Since: 2.76 + + + + + a path buffer + + + + `TRUE` if the buffer was modified and `FALSE` otherwise + + + + + + +Extends the given path buffer with @path. + +If @path is absolute, it replaces the current path. + +If @path contains a directory separator, the buffer is extended by +as many elements the path provides. + +On Windows, both forward slashes and backslashes are treated as +directory separators. On other platforms, %G_DIR_SEPARATOR_S is the +only directory separator. + +|[<!-- language="C" --> +GPathBuf buf, cmp; + +g_path_buf_init_from_path (&buf, "/tmp"); +g_path_buf_push (&buf, ".X11-unix/X0"); +g_path_buf_init_from_path (&cmp, "/tmp/.X11-unix/X0"); +g_assert_true (g_path_buf_equal (&buf, &cmp)); +g_path_buf_clear (&cmp); + +g_path_buf_push (&buf, "/etc/locale.conf"); +g_path_buf_init_from_path (&cmp, "/etc/locale.conf"); +g_assert_true (g_path_buf_equal (&buf, &cmp)); +g_path_buf_clear (&cmp); + +g_path_buf_clear (&buf); +]| + +Since: 2.76 + + + + + a path buffer + + + + a path + + + + the same pointer to @buf, for convenience + + + + + + +Adds an extension to the file name in the path buffer. + +If @extension is `NULL`, the extension will be unset. + +If the path buffer does not have a file name set, this function returns +`FALSE` and leaves the path buffer unmodified. + +Since: 2.76 + + + + + a path buffer + + + + the file extension + + + + `TRUE` if the extension was replaced, and `FALSE` otherwise + + + + + + +Sets the file name of the path. + +If the path buffer is empty, the filename is left unset and this +function returns `FALSE`. + +If the path buffer only contains the root element (on Unix-like operating +systems) or the drive (on Windows), this is the equivalent of pushing +the new @file_name. + +If the path buffer contains a path, this is the equivalent of +popping the path buffer and pushing @file_name, creating a +sibling of the original path. + +|[<!-- language="C" --> +GPathBuf buf, cmp; + +g_path_buf_init_from_path (&buf, "/"); + +g_path_buf_set_filename (&buf, "bar"); +g_path_buf_init_from_path (&cmp, "/bar"); +g_assert_true (g_path_buf_equal (&buf, &cmp)); +g_path_buf_clear (&cmp); + +g_path_buf_set_filename (&buf, "baz.txt"); +g_path_buf_init_from_path (&cmp, "/baz.txt"); +g_assert_true (g_path_buf_equal (&buf, &cmp); +g_path_buf_clear (&cmp); + +g_path_buf_clear (&buf); +]| + +Since: 2.76 + + + + + a path buffer + + + + the file name in the path + + + + `TRUE` if the file name was replaced, and `FALSE` otherwise + + + + + + +Retrieves the built path from the path buffer. + +On Windows, the result contains backslashes as directory separators, +even if forward slashes were used in input. + +If the path buffer is empty, this function returns `NULL`. + +Since: 2.76 + + + + + a path buffer + + + + the path + + + + Gets the last component of the filename. @@ -38616,7 +39135,7 @@ Since: 2.70 Outputs a formatted message via the print handler. -The default print handler simply outputs the message to stdout, without +The default print handler outputs the encoded message to stdout, without appending a trailing new-line character. Typically, @format should end with its own new-line character. @@ -38643,7 +39162,7 @@ g_warning() and g_error(). Outputs a formatted message via the error message handler. -The default handler simply outputs the message to stderr, without appending +The default handler outputs the encoded message to stderr, without appending a trailing new-line character. Typically, @format should end with its own new-line character. @@ -45573,19 +46092,28 @@ could only be called once per process. -Sets the print handler. +Sets the print handler to @func, or resets it to the +default GLib handler if %NULL. Any messages passed to g_print() will be output via -the new handler. The default handler simply outputs -the message to stdout. By providing your own handler +the new handler. The default handler outputs +the encoded message to stdout. By providing your own handler you can redirect the output, to a GTK+ widget or a log file for example. +Since 2.76 this functions always returns a valid +#GPrintFunc, and never returns %NULL. If no custom +print handler was set, it will return the GLib +default print handler and that can be re-used to +decorate its output and/or to write to stderr +in all platforms. Before GLib 2.76, this was %NULL. + - the new print handler + the new print handler or %NULL to +reset to the default @@ -45595,19 +46123,28 @@ log file for example. -Sets the handler for printing error messages. +Sets the handler for printing error messages to @func, +or resets it to the default GLib handler if %NULL. Any messages passed to g_printerr() will be output via -the new handler. The default handler simply outputs the +the new handler. The default handler outputs the encoded message to stderr. By providing your own handler you can redirect the output, to a GTK+ widget or a log file for example. +Since 2.76 this functions always returns a valid +#GPrintFunc, and never returns %NULL. If no custom error +print handler was set, it will return the GLib default +error print handler and that can be re-used to decorate +its output and/or to write to stderr in all platforms. +Before GLib 2.76, this was %NULL. + - the new error message handler + he new error message handler or %NULL +to reset to the default @@ -47853,17 +48390,13 @@ Since: 2.48 -Allocates a block of memory from the slice allocator. +Allocates a block of memory from the libc 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. +to at least `1 * sizeof (void*)`. -Note that the underlying slice allocation mechanism can -be changed with the [`G_SLICE=always-malloc`][G_SLICE] -environment variable. +Since GLib 2.76 this always uses the system malloc() implementation +internally. Since: 2.10 @@ -47883,9 +48416,10 @@ be %NULL if and only if @mem_size is 0 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. +the returned memory to 0. + +Since GLib 2.76 this always uses the system malloc() implementation +internally. Since: 2.10 @@ -47896,8 +48430,8 @@ Since: 2.10 - a pointer to the allocated block, which will be %NULL if and only -if @mem_size is 0 + a pointer to the allocated block, which will be %NULL +if and only if @mem_size is 0 @@ -47909,6 +48443,9 @@ and copies @block_size bytes into it from @mem_block. @mem_block must be non-%NULL if @block_size is non-zero. +Since GLib 2.76 this always uses the system malloc() implementation +internally. + Since: 2.14 @@ -47922,8 +48459,8 @@ Since: 2.14 - a pointer to the allocated memory block, which will be %NULL if and -only if @mem_size is 0 + a pointer to the allocated memory block, +which will be %NULL if and only if @mem_size is 0 @@ -47936,12 +48473,12 @@ the slice allocator. It calls g_slice_copy() with `sizeof (@type)` and casts the returned pointer to a pointer of the given type, avoiding a type cast in the source code. -Note that the underlying slice allocation mechanism can -be changed with the [`G_SLICE=always-malloc`][G_SLICE] -environment variable. This can never return %NULL. +Since GLib 2.76 this always uses the system malloc() implementation +internally. + Since: 2.14 @@ -47969,11 +48506,12 @@ been allocated from the slice allocator. It calls g_slice_free1() using `sizeof (type)` as the block size. 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. +[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable. If @mem is %NULL, this macro does nothing. +Since GLib 2.76 this always uses the system free() implementation internally. + Since: 2.10 @@ -47998,10 +48536,13 @@ The memory must have been allocated via g_slice_alloc() or g_slice_alloc0() and the @block_size has to match the size specified upon allocation. 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. +variable. If @mem_block is %NULL, this function does nothing. +Since GLib 2.76 this always uses the system free_sized() implementation +internally. + Since: 2.10 @@ -48027,11 +48568,12 @@ 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. +[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable. If @mem_chain is %NULL, this function does nothing. +Since GLib 2.76 this always uses the system free() implementation internally. + Since: 2.10 @@ -48061,11 +48603,13 @@ g_slice_alloc() or g_slice_alloc0() and linked together by a @next pointer (similar to #GSList). The offset of the @next field in each block 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. +[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable. If @mem_chain is %NULL, this function does nothing. +Since GLib 2.76 this always uses the system free_sized() implementation +internally. + Since: 2.10 @@ -48093,13 +48637,14 @@ slice allocator. It calls g_slice_alloc() with `sizeof (@type)` and casts the returned pointer to a pointer of the given type, avoiding a type -cast in the source code. Note that the underlying slice allocation -mechanism can be changed with the [`G_SLICE=always-malloc`][G_SLICE] -environment variable. +cast in the source code. This can never return %NULL as the minimum allocation size from `sizeof (@type)` is 1 byte. +Since GLib 2.76 this always uses the system malloc() implementation +internally. + Since: 2.10 @@ -48123,13 +48668,13 @@ slice allocator and set the memory to 0. It calls g_slice_alloc0() with `sizeof (@type)` and casts the returned pointer to a pointer of the given type, avoiding a type cast in the source code. -Note that the underlying slice allocation mechanism can -be changed with the [`G_SLICE=always-malloc`][G_SLICE] -environment variable. This can never return %NULL as the minimum allocation size from `sizeof (@type)` is 1 byte. +Since GLib 2.76 this always uses the system malloc() implementation +internally. + Since: 2.10 @@ -49069,7 +49614,8 @@ the @context is running in. - a #GMainContext (if %NULL, the default context will be used) + a #GMainContext (if %NULL, the global-default +main context will be used) @@ -52624,6 +53170,9 @@ If @free_segment is %TRUE it also frees the character data. If it's %FALSE, the caller gains ownership of the buffer and must free it after use with g_free(). +Instead of passing %FALSE to this function, consider using +g_string_free_and_steal(). + @@ -52641,6 +53190,27 @@ free it after use with g_free(). + + +Frees the memory allocated for the #GString. + +The caller gains ownership of the buffer and +must free it after use with g_free(). + +Since: 2.76 + + + + + a #GString + + + + the character data of @string + + + + Transfers ownership of the contents of @string to a newly allocated @@ -55477,8 +56047,9 @@ g_test_trap_assert_stderr ("*semagic43*"); Since: 2.16 Deprecated: This function is implemented only on Unix platforms, -and is not always reliable due to problems inherent in -fork-without-exec. Use g_test_trap_subprocess() instead. +is not always reliable due to problems inherent in fork-without-exec +and doesn't set close-on-exec flag on its file descriptors. +Use g_test_trap_subprocess() instead. @@ -56085,6 +56656,11 @@ pools are not affected by g_thread_pool_set_max_idle_time() since their threads are never considered idle and returned to the global pool. +Note that the threads used by exclusive threadpools will all inherit the +scheduler settings of the current thread while the threads used by +non-exclusive threadpools will inherit the scheduler settings from the +first thread that created such a threadpool. + @error can be %NULL to ignore errors, or non-%NULL to report errors. An error can only occur when @exclusive is set to %TRUE and not all @max_threads threads could be created. diff --git a/glib/src/glib_functions.defs b/glib/src/glib_functions.defs index 5408dad5..914c1ba8 100644 --- a/glib/src/glib_functions.defs +++ b/glib/src/glib_functions.defs @@ -8151,6 +8151,15 @@ ) ) +(define-function g_free_sized + (c-name "g_free_sized") + (return-type "none") + (parameters + '("gpointer" "mem") + '("size_t" "size") + ) +) + (define-function g_clear_pointer (c-name "g_clear_pointer") (return-type "none") @@ -8294,6 +8303,16 @@ ) ) +(define-function g_aligned_free_sized + (c-name "g_aligned_free_sized") + (return-type "none") + (parameters + '("gpointer" "mem") + '("size_t" "alignment") + '("size_t" "size") + ) +) + (define-function g_mem_set_vtable (c-name "g_mem_set_vtable") (return-type "none") @@ -9157,6 +9176,117 @@ +;; From gpathbuf.h + +(define-function g_path_buf_new + (c-name "g_path_buf_new") + (is-constructor-of "GPathBuf") + (return-type "GPathBuf*") +) + +(define-function g_path_buf_new_from_path + (c-name "g_path_buf_new_from_path") + (return-type "GPathBuf*") + (parameters + '("const-char*" "path") + ) +) + +(define-method init + (of-object "GPathBuf") + (c-name "g_path_buf_init") + (return-type "GPathBuf*") +) + +(define-method init_from_path + (of-object "GPathBuf") + (c-name "g_path_buf_init_from_path") + (return-type "GPathBuf*") + (parameters + '("const-char*" "path") + ) +) + +(define-method clear + (of-object "GPathBuf") + (c-name "g_path_buf_clear") + (return-type "none") +) + +(define-method clear_to_path + (of-object "GPathBuf") + (c-name "g_path_buf_clear_to_path") + (return-type "char*") +) + +(define-method free + (of-object "GPathBuf") + (c-name "g_path_buf_free") + (return-type "none") +) + +(define-method free_to_path + (of-object "GPathBuf") + (c-name "g_path_buf_free_to_path") + (return-type "char*") +) + +(define-method copy + (of-object "GPathBuf") + (c-name "g_path_buf_copy") + (return-type "GPathBuf*") +) + +(define-method push + (of-object "GPathBuf") + (c-name "g_path_buf_push") + (return-type "GPathBuf*") + (parameters + '("const-char*" "path") + ) +) + +(define-method pop + (of-object "GPathBuf") + (c-name "g_path_buf_pop") + (return-type "gboolean") +) + +(define-method set_filename + (of-object "GPathBuf") + (c-name "g_path_buf_set_filename") + (return-type "gboolean") + (parameters + '("const-char*" "file_name") + ) +) + +(define-method set_extension + (of-object "GPathBuf") + (c-name "g_path_buf_set_extension") + (return-type "gboolean") + (parameters + '("const-char*" "extension") + ) +) + +(define-method to_path + (of-object "GPathBuf") + (c-name "g_path_buf_to_path") + (return-type "char*") +) + +(define-function g_path_buf_equal + (c-name "g_path_buf_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + + + ;; From gpattern.h (define-function g_pattern_spec_new @@ -11966,14 +12096,6 @@ ) ) -(define-function g_strdup - (c-name "g_strdup") - (return-type "gchar*") - (parameters - '("const-gchar*" "str") - ) -) - (define-function g_strdup_printf (c-name "g_strdup_printf") (return-type "gchar*") @@ -12278,13 +12400,10 @@ ) ) -(define-method free +(define-method free_and_steal (of-object "GString") - (c-name "g_string_free") + (c-name "g_string_free_and_steal") (return-type "gchar*") - (parameters - '("gboolean" "free_segment") - ) ) (define-method free_to_bytes @@ -12555,15 +12674,6 @@ ) ) -(define-method append_c_inline - (of-object "GString") - (c-name "g_string_append_c_inline") - (return-type "GString*") - (parameters - '("gchar" "c") - ) -) - (define-method down (of-object "GString") (c-name "g_string_down") -- cgit v1.2.1