summaryrefslogtreecommitdiff
path: root/docs/reference/glib/glib-sections.txt
Commit message (Collapse)AuthorAgeFilesLines
* glib-sections.txt: Add g_macro__has_extension in private sectionclang-cl-improvementsChun-wei Fan2021-03-311-0/+1
| | | | This should satisfy the documentation build check.
* gtree: Make g_tree_remove_all() publicliuyangming2021-03-231-0/+1
| | | | | g_tree_remove_all is useful and the corresponding function in GHashTable is exposed, so make this function public is meaningful.
* gmain: Add g_steal_fd() to APISimon McVittie2021-03-221-0/+3
| | | | | | | This is basically glnx_steal_fd() from libglnx. We already had two private implementations of it in GLib. Signed-off-by: Simon McVittie <smcv@collabora.com>
* gversionmacros: Add version macros for GLib 2.70Simon McVittie2021-03-181-0/+14
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* gspawn: Add new g_spawn_async_with_pipes_and_fds() APIPhilip Withnall2021-02-161-0/+1
| | | | | | | | | This is a simple wrapper around the new source/target FD mapping functionality in `fork_exec()`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #2097
* string: Add find and replace functionJoshua Lee2021-02-091-0/+1
| | | | | | | | | This adds g_string_replace(), a function that replaces instances of one string with another in a GString. It allows the caller to specify the maximum number of replacements to perform, and returns the number of replacements performed to the caller. Fixes: #225
* gstrfuncs: Add g_memdup2() functionPhilip Withnall2021-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | This will replace the existing `g_memdup()` function, which has an unavoidable security flaw of taking its `byte_size` argument as a `guint` rather than as a `gsize`. Most callers will expect it to be a `gsize`, and may pass in large values which could silently be truncated, resulting in an undersize allocation compared to what the caller expects. This could lead to a classic buffer overflow vulnerability for many callers of `g_memdup()`. `g_memdup2()`, in comparison, takes its `byte_size` as a `gsize`. Spotted by Kevin Backhouse of GHSL. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: GHSL-2021-045 Helps: #2319
* glib_typeof: It is an API break that should be opt-inXavier Claessens2021-01-271-0/+1
| | | | | | | | | | | | | | | | That changes the return type of functions like g_object_ref() that can break C++ applications like Webkit. Note that it is not an ABI break. It must thus be opt-in the same way we did when adding this to g_object_ref() for GNU C compilers in the first place. Unfortunately it cannot be done directly in gmacros.h because GLIB_VERSION_2_68 is not defined there, and gversionmacros.h cannot be included there because there is some strict ordering in which those headers must be included. This means that applications that does not define GLIB_VERSION_MIN_REQUIRED will still get an API break, so we encourage them to declare their minimum requirement to avoir such issues in the future too.
* gtestutils: Add g_test_get_path() APIJonas Ådahl2021-01-251-0/+1
| | | | | | | | I found myself wanting to know the test that is currently being run, where e.g. __func__ would be inconvenient to use, because e.g. the place the string was needed was not in the test case function. Using __func__ also relies on the test function itself containing the whole path, while loosing the "/" information that is part of the test path.
* docs: Add documentation for GLIB_VERSION_CUR_STABLE and PREV_STABLEPhilip Withnall2021-01-191-0/+2
| | | | | | It was missing. Oh no! Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* gerror: Add support for extended errorsKrzesimir Nowak2021-01-061-0/+7
| | | | | | This commit adds a G_DEFINE_EXTENDED_ERROR macro and g_error_domain_register() functions to register extended error domains.
* Adding macros G_NORETURN and G_NORETURN_FUNCPTREmmanuel Fleury2020-11-251-0/+2
| | | | | | This macro is borrowed from the gnulib project in the 'noreturn.h' file. Fixes: #994
* gtimezone: Add new constructor which can report errorsPhilip Withnall2020-11-181-0/+1
| | | | | | | | | Add a new variant of `g_time_zone_new()` which returns `NULL` on failure to load a timezone, rather than silently returning UTC. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #553
* gtestutils: Add g_assert_cmpstrv()Niels De Graef2020-11-141-0/+1
| | | | | | | Add a test util function that helps asserting two string arrays are the same, and which adds some useful information if they're not. Fixes: #2015
* Merge branch 'typeof' into 'master'Philip Withnall2020-10-151-1/+1
|\ | | | | | | | | Use C++11 decltype where possible See merge request GNOME/glib!1575
| * Replace __typeof__ with glib_typeof macroXavier Claessens2020-10-141-1/+1
| | | | | | | | | | | | | | g_has_typeof macro is wrongly in the public g_ namespace, internaly symbols are usually in the glib_ namespace. This will also allow to define glib_typeof differently on non-GNUC compilers (e.g. c++11 decltype).
* | gstrvbuilder: Add a new object to make NULL-terminated string arrays.Robert Ancell2020-10-141-0/+6
|/ | | | | | | GLib uses NULL-terminated string arrays (GStrv) in a number of places, however these are quite hard to construct in C when the number of elements is not known in advance. GStrvBuilder wraps GPtrArray to make these easy to create with type safety and does the memory management for you.
* gmessages: Expose our default filtering as APISimon McVittie2020-10-071-0/+1
| | | | | | | | | This allows programs that want to change how log messages are printed, such as gnome-terminal (gnome-terminal#42) and Flatpak, to override the log-writer or the legacy log-handler without having to reimplement the G_MESSAGES_DEBUG filtering logic. Signed-off-by: Simon McVittie <smcv@collabora.com>
* gmessages: Add API to move info and debug messages to stderrSimon McVittie2020-10-071-0/+1
| | | | | | | | | | | | | | | | | | | | | GLib code normally prints info and debug messages to stdout, but that interferes with programs that are documented to produce machine-readable output such as JSON or XML on stdout. In particular, if such a program uses a GLib-based library, setting G_MESSAGES_DEBUG will typically result in that library's debug messages going to the program's stdout and corrupting the machine-readable output. Unix programs can avoid this by using dup2() to move the original stdout to another fd, then dup2() again to make the new stdout a copy of stderr, but it's easier if we provide a way to not write debug messages to stdout in the first place. Calling g_log_writer_default_set_use_stderr (TRUE) results in behaviour resembling Python's logging.basicConfig(), with all diagnostics going to stderr. Suggested by Allison Karlitskaya on glib#2087. Signed-off-by: Simon McVittie <smcv@collabora.com>
* GTree: add an ability to iterate over a tree and a node-based APIMaciej S. Szmigiero2020-10-061-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic API that this commit adds allows in-order iterating over a GTree. For this the following API were implemented or exported: 1) Returning the first or the last node in the tree, 2) Taking a pointer to a node in the tree and returning the previous or the next in-order node, 3) Allowing to do a binary search for a particular key value and returning the pointer to its node, 4) Returning the newly inserted or set node from both insert and replace functions, so this node is immediately available and does not have to be looked up, 5) Traversing the tree in-order providing a node pointer to the caller-provided traversal function. Most of the above functions were already present in the code, but they returned the value that is stored at a particular node instead of the pointer to the node itself. So most of the code for these new API calls is shared with these existing ones, just adapted to return the pointer to the node. Additionally, the so called "lower bound" and "upper bound" operations were implemented. The first one returns the first element that is greater than or equal to the searched key, while the second returns the first element that is strictly greater than the searched key. Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
* gversionmacros: Add version macros for GLib 2.68Philip Withnall2020-10-011-0/+14
| | | | Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* uri: add GUriParamsIterMarc-André Lureau2020-08-041-0/+3
| | | | | See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1328#note_863735
* gfileutils: Add g_file_set_contents_full() and GFileSetContentsFlagsPhilip Withnall2020-07-261-0/+2
| | | | | | | | | | | | | This is a new version of the g_file_set_contents() API which will allow its safety to be controlled by some flags, allowing the user to choose their preferred tradeoff between safety (`fsync()` calls) and speed. Currently, the flags do nothing and the new API behaves like the old API. This will change in the following commits. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1302
* uri: modify g_uri_parse_params() to take flagsMarc-André Lureau2020-07-071-0/+1
| | | | | | | This will allow to further enhance the parsing, without breaking API, and also makes argument on call side a bit clearer than just TRUE/FALSE. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* guri: new URI parsing and generating functionsDan Winship2020-06-251-2/+46
| | | | | | | | | | | | Add a set of new URI parsing and generating functions, including a new parsed-URI type GUri. Move all the code from gurifuncs.c into guri.c, reimplementing some of those functions (and g_string_append_uri_encoded()) in terms of the new code. Fixes: https://gitlab.gnome.org/GNOME/glib/issues/110 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* gbookmarkfile: Add Y2038-proof APIs to GBookmarkFilePhilip Withnall2020-05-281-0/+8
| | | | | | | | | | | | These are alternatives to the existing `time_t`-based APIs, which will soon be deprecated due to `time_t` only being Y2038-safe on 64-bit systems. The new APIs take a GDateTime instead. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1931
* Revert "Revert "glib: annotate static inline functions with G_AVAILABLE-type ↵Philip Withnall2020-05-151-0/+6
| | | | | | | | | | | | macros"" This reverts commit c0146be3a4e0cda7a23d7fd54cc60a0bc7ba7f7a. The revert was originally added because the original change broke gnome-build-meta. Now that the problem has been diagnosed, the original commit can be fixed — see the commit which follows this one. See: !1487
* gtestutils: Add a new g_assert_no_errno() test macroPhilip Withnall2020-03-041-0/+1
| | | | | | | | | | | | This is for use in testing POSIX-style functions like `rmdir()`, which return an integer < 0 on failure, and return their error information in `errno`. The new macro prints `errno` and `g_strerror (errno)` on failure. Includes a unit test. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* gversionmacros: Add version macros for GLib 2.66Philip Withnall2020-03-041-0/+13
| | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Add and use G_SIZEOF_MEMBER() macroMarc-André Lureau2020-01-211-0/+1
| | | | | | A convenient macro present in the Linux kernel, named FIELD_SIZE() there. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* docs: Add g_source_set_dispose_function() to documentationPhilip Withnall2019-12-161-0/+2
| | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* Merge branch 'thread-safe-getpwnam' into 'master'Emmanuele Bassi2019-11-271-0/+3
|\ | | | | | | | | | | | | glocalvfs: Use thread-safe getpwnam_r() rather than getpwnam() Closes #1687 See merge request GNOME/glib!681
| * glib-unix: Add g_unix_get_passwd_entry() functionPhilip Withnall2019-11-261-0/+3
| | | | | | | | | | | | | | | | | | This is a convenience wrapper around getpwnam_r() which handles all the memory allocation faff. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1687
* | list, slist: Add g_clear_{s,}list()Ernestas Kulik2019-11-251-0/+2
|/ | | | | | | | | | | | | Although not quite as often-occurring, this should help with constructs like this: if (list) { g_list_free_full (list, foo); list = NULL; } Closes https://gitlab.gnome.org/GNOME/glib/issues/1943
* gmain: Add GMainContextPusher convenience APIPhilip Withnall2019-10-231-0/+5
| | | | | | | | | | | | This is like `GMutexLocker`, in that if you are able to use `g_autoptr()`, it makes popping a `GMainContext` off the thread-default main context stack easier when exiting a function. A few uses of `G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS` are needed to avoid warnings when building apps against GLib with `GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64`. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* gmessages: Add g_warning_once()Jonas Ådahl2019-10-091-0/+1
| | | | | | | | | | | | | | | | In many places the pattern static gboolean warned_once = FALSE; if (!warned_once) { g_warning ("This and that"); warned_once = TRUE; } is used to not spam the same warning message over and over again. Add a helper in glib for this, allowing the above statement to be changed to g_warning_once ("This and that");
* Merge branch 'g-os-info' into 'master'Philip Withnall2019-10-081-0/+14
|\ | | | | | | | | gutils: Add g_get_os_info() See merge request GNOME/glib!1063
| * gutils: Add g_get_os_info()Robert Ancell2019-09-271-0/+14
| | | | | | | | Add a new function that gets OS information for /etc/os-release.
* | Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()Paolo Bonzini2019-10-071-0/+3
|/ | | | Closes issue #285
* Add a wrapper for fsync() functionTodd Goyen2019-09-181-0/+1
| | | | Closes issue #35
* gversionmacros: Add version macros for GLib 2.64Philip Withnall2019-09-171-0/+13
| | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* gdatetime: Add g_date_time_format_iso8601() convenience functionPhilip Withnall2019-07-291-0/+1
| | | | | | | | | | | This is a simple wrapper around g_date_time_format_iso8601() which always produces ISO 8601 dates, without people having to remember the format string for them (and with the convenience of terminating UTC dates with ‘Z’ rather than ‘+00’). Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1438
* doc: Add missing GLIB_DEPRECATED_TYPE and friendsXavier Claessens2019-07-101-0/+180
| | | | | They are private but still must be put into sections.txt otherwise gtkdoc-check complains.
* Add g_array_binary_search() to garray APIEmmanuel Fleury2019-07-091-0/+1
| | | | | | Original code written by Christian Hergert Fix issue #373
* Adding a function g_array_copy() to glib/garray.cEmmanuel Fleury2019-06-271-0/+1
| | | | | | Original code from Simon van der Linden Close issue #236
* Adding g_ptr_array_extend_and_steal() function to glib/garray.cEmmanuel Fleury2019-06-271-0/+1
|
* Adding g_ptr_array_extend() function to glib/garray.cEmmanuel Fleury2019-06-261-0/+1
| | | | Related to issue #269
* Adding g_ptr_array_copy() function to glib/garray.cEmmanuel Fleury2019-06-261-0/+1
| | | | Related to issue #269
* Add g_timer_is_activeTristan Partin2019-06-211-0/+1
| | | | Helper function for exposing the internal state of a GTimer.
* Add g_get_console_charsetPatrick Storz2019-05-271-0/+1
| | | | | | | | Queries the charset used by the associated console, which does not necessarily match the charset of the current locale as returned by g_get_charset. Fixes https://gitlab.gnome.org/GNOME/glib/issues/1270