1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00

33184 Commits

Author SHA1 Message Date
Philip Withnall
70339fa090 2.89.3
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.89.3
2026-07-29 13:15:43 +01:00
Emmanuele Bassi
cab2aa8f05 Merge branch 'meson-1.12-fixes' into 'main'
build: Fix a deprecation warning from Meson 1.12

See merge request GNOME/glib!5249
2026-07-29 12:54:34 +01:00
Emmanuele Bassi
9a87dbd5d4 Merge branch 'buildcsystem' into 'main'
gtestutils: Fix a minor typo in a documentation comment

See merge request GNOME/glib!5246
2026-07-29 12:53:54 +01:00
Philip Withnall
855c6d7a7e Merge branch 'wip/otte/speed-demon' into 'main'
Add finer accuracy g_timeout APIs

See merge request GNOME/glib!5254
2026-07-29 11:38:09 +00:00
Benjamin Otte
b1e4bdb036 tests: Add another test for ready times 2026-07-29 13:26:53 +02:00
Benjamin Otte
bdf53d7570 API: Add g_source_get_ready_time_ns()
Related: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5254#note_2819657
2026-07-29 13:26:53 +02:00
Benjamin Otte
cab0dd3c4f main: Port timeout source to new nanosecond APIs 2026-07-29 13:26:53 +02:00
Benjamin Otte
c006f0a514 API: Add g_source_get_time_ns() 2026-07-29 13:26:53 +02:00
Benjamin Otte
d110a71164 API: Add g_source_set_ready_time_ns()
Now that the main loop works in nanoseconds internally, we want to
expose it in the public API.
2026-07-29 13:26:53 +02:00
Benjamin Otte
6bb4e8aa25 main: Transition last part of the code to nanoseconds
This transitions GMainContext.time and GSource.ready_time to
nanoseconds.

Special care had to be taken with g_source_set_ready_time() because of
potential overflows and the special meaning of certain values.
2026-07-29 13:26:53 +02:00
Philip Withnall
73805581e2 Merge branch 'fix-gio-help-help' into 'main'
gio: Handle "gio help help" correctly

Closes #4007

See merge request GNOME/glib!5258
2026-07-28 23:06:10 +00:00
Jose Carlos Leiva
cb9e99bcc2 gio: Handle "gio help help" correctly
Avoid triggering an assertion when requesting help for the
help subcommand. Instead, report that help cannot be displayed
for the help subcommand and exit with an error.

Fixes: #4007
2026-07-28 23:06:10 +00:00
Benjamin Otte
0d957f234a main: Transition next part of the code to nanoseconds
This transitions the GMainContext timeout variable which collects the
timeouts of the GSources.
2026-07-28 21:25:26 +02:00
Benjamin Otte
b8899f9453 main: Transition a part of the code to nanoseconds
There is a small API surface of a single function between the poll()
code and the context/source time storage, so convert the poll() part to
nanoseconds first.

Makes it (hopefully) easier to track down any issues later.
2026-07-28 21:25:26 +02:00
Benjamin Otte
87041f4df7 API: Add g_source_clear_ready_time()
This is the first API towards adding nanosecond precision ready time.

It provides an explicit way to unset ready times.

Some tests have been adapted to use this function.

Related: !5254
2026-07-28 21:25:26 +02:00
Benjamin Otte
6e4d7518c7 main: Add GSourcePrivate->has_ready_time
Split the meaning of an unset ready time from ready_time == -1 to
an explicit boolean.

Makes the code cleaner and prepares for future changes for nanosecond
accuracy.
2026-07-27 19:22:42 +02:00
Benjamin Otte
bc1494f993 Add tests for g_timeout_new_ns() 2026-07-27 19:22:42 +02:00
Benjamin Otte
667b93afc2 API: Add g_timeout_source_new_ns()
Allow finer-grained timeout sources in the API.
2026-07-27 19:22:38 +02:00
Philip Withnall
90b0a7e9de Merge branch 'usr_etc' into 'main'
Reading and merging configuration files defined by the Linux Userspace API Group

Closes #3622

See merge request GNOME/glib!4671
2026-07-27 13:51:00 +00:00
Stefan Schubert
210526cb49 Reading and merging configuration files defined by the Linux Userspace API Group 2026-07-27 13:51:00 +00:00
Philip Withnall
7bc1f61efe Merge branch 'wip/unix-fd-list-additions' into 'main'
gunixfdlist: Add g_unix_fd_list_append_take, g_unix_fd_list_peek, g_unix_fd_list_lookup, g_unix_fd_list_lookup_peek

See merge request GNOME/glib!5233
2026-07-27 11:38:15 +00:00
Philip Withnall
0aa3ded025 Merge branch 'macros-with-reserved-identifiers' into 'main'
Avoid reserved identifiers in public macros

See merge request GNOME/glib!5257
2026-07-26 22:42:51 +00:00
Philip Chimento
0213ee7354 Avoid reserved identifiers in public macros
Clang-tidy has a check to prohibit identifiers that are reserved for the
compiler. Those are identifiers that start with:
  - an underscore plus an uppercase letter
  - two underscores
  - an underscore, and are in the global scope
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/reserved-identifier.html

Many public GLib macros define variables starting with two underscores,
which is technically not allowed. This is probably usually harmless, but
it causes false positives in the abovementioned clang-tidy check when
consumers of GLib use macros like G_VALUE_HOLDS_POINTER or
g_str_has_suffix.

This commit replaces all such names with one-underscore names, which are
not reserved because they're not in the global scope.

Here's the incantation I used to discover which macros needed editing:

git grep -P '\b__(?!builtin|atomic|sync|asm|volatile|pragma)[a-z].*\\$' \
  -- '*.h' | grep -v valgrind.h

This generates a manageable number of false positives. It also fails to
find identifiers on the last line of a macro, but those are generally
already mentioned elsewhere in the macro.

I left valgrind.h untouched.
2026-07-26 14:12:11 -07:00
Philip Withnall
32552c298f Merge branch 'wip/p3732/set-datetime' into 'main'
datetime: Add g_set_date_time

See merge request GNOME/glib!5193
2026-07-26 13:34:20 +00:00
Philip Withnall
3ca4532ce1 Merge branch 'wip/p3732/give-and-take' into 'main'
Add g_string_free_deep

See merge request GNOME/glib!4919
2026-07-26 13:30:14 +00:00
Michael Catanzaro
d58aae6701 Merge branch 'joantolo/fix-unown-name-again' into 'main'
gdbusnameowning: Don't print any logs when connection is closed

See merge request GNOME/glib!5255
2026-07-24 17:59:52 -05:00
Peter Eisenmann
20dc3c9e1c string: Add g_string_free_deep
Can be used in combination with g_clear_pointer to unconditionally
free a GString.
2026-07-24 13:17:03 +02:00
Peter Eisenmann
bb63c1ee36 datetime: Add g_set_date_time
An equivalent to other g_set_* helper functions for GDateTime. It
replaces the previous value if it is not exactly the same, e.g. if the
timezones differ. This relyies on  g_date_time_get_timezone_abbreviation
returning the same pointer for equal timezones.
2026-07-24 13:04:41 +02:00
Joan Torres Lopez
fec1d0d35a gdbusnameowning: Don't print any logs when connection is closed
If the connection was already closed there's no value in printing the
error.
2026-07-24 10:55:34 +02:00
Benjamin Otte
63f720a2d9 timeoutsource: Store interval in nanoseconds
This is preparation for future commits.
2026-07-24 05:44:27 +02:00
Philip Withnall
c3f4fbf1d8 Merge branch 'fix_fd_leak' into 'main'
gfileutils: fix an fd leak on error in g_file_set_contents_full()

Closes #3999

See merge request GNOME/glib!5253
2026-07-23 20:55:42 +00:00
Kondor Dániel
7a1b581ceb gfileutils: fix an fd leak on error in g_file_set_contents_full()
We need to close the file descriptor of the temporary file used if the `fchmod()` call fails.

Closes #3999
2026-07-23 22:37:40 +02:00
Philip Withnall
6a7a743f75 Merge branch 'enuma-document-new-members' into 'main'
docs: Use dedicated docblocks for new enum members

See merge request GNOME/glib!5251
2026-07-20 18:57:25 +00:00
Maximiliano Sandoval
7d9c134387 gtestutils: Move SubprocessFlags docs next to enum 2026-07-20 20:43:34 +02:00
Maximiliano Sandoval
bac9e83e6a giochannel: Move GIOFlags docstring next to def 2026-07-20 20:37:22 +02:00
Maximiliano Sandoval
146ef76510 gunicode: Add missing AVAILABLE_ENUMERATOR macros 2026-07-20 20:37:22 +02:00
Maximiliano Sandoval
6ff6b2ebaa gutils: Move GFormatSizeFlags docstring to .c file
Right next to the enum itself.
2026-07-20 20:37:22 +02:00
Maximiliano Sandoval
9c53ee8b75 docs: Capitalize enum members docstrings
The previous commit added separated doc blocks for certain enum members,
in those cases those needed to be capitalized accordingly so in this
commit we capitalize the remaining enum members.
2026-07-20 20:37:22 +02:00
Maximiliano Sandoval
9089e9a613 docs: Use dedicated docblocks for new enum members
... added since 2.74. 2.74 was selected arbitrarily.

When a Since annotation is written inline for an enum member, g-ir won't
parse it, they need dedicated doc blocks.
2026-07-20 20:37:22 +02:00
Maximiliano Sandoval
887f7becf0 docs: gspawn: Remove duplicated docstrings
The flags G_SPAWN_CHILD_* flags were already documented below. When
enum Since tags are inline g-ir does not parse them.
2026-07-20 20:37:19 +02:00
Philip Withnall
ee55fbf33a Merge branch 'closure-annotation' into 'main'
docs: Annotate callbacks rather than user_data

See merge request GNOME/glib!5252
2026-07-20 17:11:15 +00:00
Maximiliano Sandoval
c4bf04f68f docs: Annotate callbacks rather than user_data
See
https://gi.readthedocs.io/en/latest/annotations/giannotations.html#callbacks
for more details.

These caused invalid "closure" annotation warnings.
2026-07-18 16:54:42 +02:00
Sebastian Wick
a2bf78d6ab gio/tests/unix-fd: Test GUnixFDList append_take, peek and lookup 2026-07-15 16:21:37 +02:00
Sebastian Wick
f261fda588 gunixfdlist: Add g_unix_fd_list_lookup
A variant of g_unix_fd_list_peek that can be used to lookup file
descriptors with an unvalidated index, to avoid manual validation.

This is especially handy when dealing with GDBus where the index is
usually attacker controlled. Experience has shown that validation is
spotty and often incomplete.

The variants hopefully will make this less of an issue.
2026-07-15 16:14:02 +02:00
Sebastian Wick
579a3c0dec gunixfdlist: Add g_unix_fd_list_append_take and g_unix_fd_list_peek
Those variants allow users to avoid dup'ing the fd if there is no need
for it:

* `g_unix_fd_list_append_take` takes ownership over a fd
* `g_unix_fd_list_peek` gets a fd at an index without taking ownership
2026-07-15 16:14:02 +02:00
Sebastian Wick
e107e82cbb gunixfdlist: Update docs to the gi-docgen format 2026-07-15 16:14:02 +02:00
Sebastian Wick
e9d5356592 gunixfdlist: Switch to size_t and avoid overflows 2026-07-15 16:14:02 +02:00
Sebastian Wick
5b4eb3a078 gunixfdlist: Use g_realloc_n to re-allocate the fds array 2026-07-15 15:53:18 +02:00
Sebastian Wick
dffff0196f gunixfdlist: Catch programmer error of index < 0 in g_unix_fd_list_get 2026-07-15 15:53:18 +02:00
Philip Withnall
f91e4a3365 Merge branch 'solaris-iptosmessage-skip' into 'main'
gio/tests: Skip iptosmessage on Solaris

Closes #3994

See merge request GNOME/glib!5250
2026-07-15 08:40:48 +00:00