Commit Graph

26718 Commits

Author SHA1 Message Date
Philip Withnall
26728b4ecc Merge branch 'gstring-optimizations' into 'main'
Some GString optimizations

See merge request GNOME/glib!3199
2023-01-16 12:38:54 +00:00
Matthias Clasen
908bd08dc5 Try to make gtk-doc happy 2023-01-14 12:55:25 -05:00
Matthias Clasen
0a26b1c038 markup: Use g_string_truncate
We don't need a private inline helper
for this anymore.
2023-01-14 10:08:42 -05:00
Matthias Clasen
6bb9fdd9c7 markup: Replace a g_string_insert_len call
This lets us use the optimized inline call.
2023-01-14 09:44:22 -05:00
Matthias Clasen
d102a4d8b2 Improve the g_string_truncate test
Test the inline version too.
2023-01-14 09:44:22 -05:00
Matthias Clasen
c191c99748 string: Add an inline g_string_truncate too
This is another very commonly used
GString function.
2023-01-14 09:44:22 -05:00
Matthias Clasen
84780536a4 Improve the g_string_append test
Test the inline versions too, and test
passing -1 for len.
2023-01-14 09:09:19 -05:00
Matthias Clasen
57de9af06f Improve the g_string_append_c test
We should check the resulting string too.
2023-01-14 09:09:19 -05:00
Matthias Clasen
9810803358 string: Optimize g_string_append(_len)
Add static inline versions of these functions
that boil down to just an memcpy. ag_string_append_len
is used quite a bit in GMarkup and GTK's css parser.
2023-01-14 09:09:19 -05:00
Matthias Clasen
0cc74d5a37 string: Add a G_LIKELY
This is the case we optimize for.
2023-01-14 09:09:15 -05:00
Emmanuele Bassi
5d0db7f0b8 Merge branch 'fix-closure-annotations' into 'main'
Fix a couple of `closure` annotations

See merge request GNOME/glib!3198
2023-01-14 08:58:28 +00:00
Matthias Clasen
34b7992fd6 string: Split g_string_maybe_expand
Split off g_string_expand, and inline just
the size check.
2023-01-14 00:05:34 -05:00
Philip Withnall
6e91e809c7 Merge branch 'banjiuqingshan-main-patch-03761' into 'main'
gio/tests/file.c:Fix expectations when running as root

See merge request GNOME/glib!3196
2023-01-13 23:35:51 +00:00
banjiuqingshan
d9a1d7524f gio/tests/file.c: Fix expectations when running as root
Includes tweaks by Philip Withnall.
2023-01-13 22:21:07 +00:00
Sebastian Dröge
79fd6fd6a0 Fix a couple of closure annotations 2023-01-13 18:06:23 +02:00
Marco Trevisan
d839282edb Merge branch 'regex-invalid-memory-access' into 'main'
gregex: Prevent invalid memory access for unmatched subpatterns

Closes #2881

See merge request GNOME/glib!3194
2023-01-12 15:22:57 +00:00
Philip Withnall
e9fc91550f Merge branch 'badcel/revert-update-closure-annotations' into 'main'
Revert "Rename user data parameters to user_data"

Closes #2827

See merge request GNOME/glib!3111
2023-01-11 14:58:31 +00:00
Philip Withnall
fdd2d706b2 gregex: Prevent invalid memory access for unmatched subpatterns
Based on a test by Emmanuel Pacaud.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2881
2023-01-11 12:14:04 +00:00
Simon McVittie
1955497993 Merge branch 'wip/smcv/gptrarray-null-term' into 'main'
garray: Update NULL termination after copying array content

Closes #2877

See merge request GNOME/glib!3190
2023-01-10 19:51:57 +00:00
Simon McVittie
71f0b3b5ea Merge branch 'wip/smcv/rlimit-nproc-error' into 'main'
tests: Improve error message if setting max processes to 1 fails

See merge request GNOME/glib!3191
2023-01-10 19:28:07 +00:00
Simon McVittie
d3356bdbe9 Merge branch 'wip/smcv/gptrarray-memcpy-nothing' into 'main'
garray: Avoid calling memcpy with no items

See merge request GNOME/glib!3192
2023-01-10 19:27:31 +00:00
Simon McVittie
952b07101f garray: Avoid calling memcpy with no items
`memcpy(NULL, ., n)` and `memcpy(., NULL, n)` are undefined behaviour,
even if *n* is zero.

When len is 0 here, callers are allowed to pass in null data, and
GPtrArray also does not guarantee to have allocated rarray->pdata yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-10 13:40:24 +00:00
Simon McVittie
68b9fd53ec garray: Update NULL termination after copying array content
ptr_array_new(len, ., TRUE) ensures that there are at least len+1
elements in pdata, and that pdata[0] is null, but leaves the rest of
pdata uninitialized. After copying the array data into pdata[1] to
pdata[len-1] inclusive, we still need to make sure pdata[len] is a
null terminator.

Note that if len is 0, then pdata is not guaranteed to be non-null. If
it's null, then we can't add null-termination to it until its size
is updated.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2877
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-10 13:35:22 +00:00
Philip Withnall
6d2705e016 Merge branch 'gnumdk/cmpint_typo' into 'main'
docs: Fix return type in cmpint

See merge request GNOME/glib!3189
2023-01-10 12:49:42 +00:00
Simon McVittie
f42316cb0b tests: Improve error message if setting max processes to 1 fails
This has historically failed on Debian autobuilders, and as a result we
have had a patch for a long time that turned a failure here into a
g_test_skip(). It's not clear whether this still happens, so I'm now
assessing whether the patch can be dropped; but if the prlimit() call
can fail for whatever reason, it would be useful for the error message
to say what limit we were trying to set.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-10 12:48:32 +00:00
Cédric Bellegarde
cf5d807881 docs: Fix return type in cmpint example 2023-01-10 11:31:25 +00:00
Simon McVittie
cabe1370ed Merge branch 'fix-glib-compile-schemas-typo' into 'main'
glib-compile-schemas: Fix typo in comparison function

See merge request GNOME/glib!3188
2023-01-09 17:12:12 +00:00
badcel
fc70f2c057
Do not name callback parameters "user_data"
Calling a callback parameter "user_data" implicitly adds the "closure" attribute in the documentation which is wrong for callbacks.
2023-01-09 14:12:16 +01:00
Philip Withnall
8cddffdf6a Merge branch 'ebassi/visibility-build-vars' into 'main'
build: Don't overwrite build variables

See merge request GNOME/glib!3184
2023-01-09 12:37:00 +00:00
Philip Withnall
8d86ae6725 Merge branch 'ebassi/glib-types-visibility' into 'main'
Include gobject-visibility.h in glib-types.h

See merge request GNOME/glib!3185
2023-01-09 12:29:07 +00:00
badcel
b24f6ca27d
Revert "Rename all user datas in callbacks to user_data"
This reverts commit 1422e5f812. The renaming of parameters implicitly introduced "closure" annotations in the documentation which are wrong on callbacks.
2023-01-09 13:23:32 +01:00
Philip Withnall
9d5bcc9491 glib-compile-schemas: Fix typo in comparison function
This caused schemas and override files to be sorted incorrectly.

Fixes a regression introduced in commit 861e82efbc.

Spotted by John Wudrick in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3155#note_1635044.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-01-09 12:20:10 +00:00
badcel
19a02d7d14
Revert "Rename user data parameters to user_data"
This reverts commit da7a31a052. The renaming of parameters implicitly introduced "closure" annotations in the documentation which are wrong on callbacks.
2023-01-09 13:09:26 +01:00
Emmanuele Bassi
79fd62ccf2 Include GObject's visibility header
The gobject-introspection build goes through the GLib types when
generating the introspection data for GLib, but it does not include
glib-object.h, otherwise all GObject symbols would end up inside the
GLib namespace. This means we need to import the gobject-visibility.h
header inside glib-types.h. Since the header is guarded by a once
pragma, it doesn't really affect any legitimate user of the C API.
2023-01-08 00:33:47 +00:00
Emmanuele Bassi
684d9aa0c3 build: Don't overwrite build variables
We cannot use `gvisibility_h` for different visibility header files; you
never know when you're going to refer to the variable again, and
projects might end up needing to retrieve the variable contents—like,
for instance, gobject-introspection using glib as a subproject.
2023-01-08 00:33:14 +00:00
Philip Withnall
ec3b1bfc45
2.75.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-01-06 12:49:52 +00:00
Emmanuele Bassi
206cbf47a5 Merge branch '2871-find-program-for-path-leak' into 'main'
gutils: Avoid possible leaks in g_find_program_for_path()

Closes #2871

See merge request GNOME/glib!3183
2023-01-06 12:33:08 +00:00
Philip Withnall
73fa684e30 Merge branch 'ptr-array-sort-values' into 'main'
garray: Add g_ptr_array_sort_values[_with_data]() wrappers

See merge request GNOME/glib!3155
2023-01-06 12:09:37 +00:00
Marco Trevisan (Treviño)
861e82efbc gio: Use g_ptr_array_sort_values()
Cleanup some code using GPtrArray sorting with functions that were taking
pointer to pointers arguments.
2023-01-06 11:46:01 +00:00
Marco Trevisan (Treviño)
0ffd23cac4 garray: Add g_ptr_array_sort_values[_with_data]() wrappers
Historically GPtrArray made possible to compare pointers of pointers values
that it holds, however this is inconvenient in most cases as it requires
wrapper functions and not friendly castings.

So, add two functions that allow to perform the comparisons between the
pointer values that a GPtrArray holds following the same syntax that we
share everywhere in the codebase.
2023-01-06 11:46:01 +00:00
Emmanuele Bassi
892deb8f93 Merge branch 'coverity-iface-null' into 'main'
gobject: Add a missing NULL check for the return from lookup_type_node_I()

See merge request GNOME/glib!3162
2023-01-05 18:57:21 +00:00
Philip Withnall
d333b06644 Merge branch 'g-win32-app-info-enhancements' into 'main'
GWin32AppInfo: Fixes for UWP (packaged) apps activation

See merge request GNOME/glib!3167
2023-01-05 17:51:06 +00:00
Philip Withnall
db2381026f gutils: Avoid possible leaks in g_find_program_for_path()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2871
2023-01-05 17:13:35 +00:00
Luca Bacci
86fccfcb70 GWin32AppInfo: Prefer file activation over URI activation for file URI's
(...unless file:// URI's are actually supported by the target app)

References:

 [1] - https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation
 [2] - https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-file-activation
2023-01-05 17:50:15 +01:00
Luca Bacci
02417db370 GWin32AppInfo: Pass only one item to ActivateForProtocol()
IApplicationActivationManager::ActivateForProtocol() only uses the first
item from the IShellItemArray. When we have to activate multiple URI's,
call ActivateForProtocol() repeatedly in a loop, each time with one URI.

References:

 [1] - IApplicationActivationManager::ActivateForProtocol method [MSDN]
       https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iapplicationactivationmanager-activateforprotocol
2023-01-05 17:46:50 +01:00
Luca Bacci
7bbbb1ee42 GWin32AppInfo: Create IShellItemArray object inside launch_uwp_internal()
The IShellItemArray object is only used in launch_uwp_internal(),
so do not make callers bother with that.
2023-01-05 17:42:03 +01:00
Philip Withnall
92f9c678f5 Merge branch 'nirbheek/meson-subproject-usage-fixes' into 'main'
Various fixes for how we interact with subproject dependencies

See merge request GNOME/glib!3177
2023-01-05 16:02:50 +00:00
Philip Withnall
637b49539b Merge branch 'actualize-links' into 'main'
INSTALL.md,README.win32.md: Actualize links

See merge request GNOME/glib!3181
2023-01-05 15:05:04 +00:00
Philip Withnall
a7d523cd08 Merge branch 'mtime-fix' into 'main'
glocalfileinfo: Don't reset mtime tv_sec when setting tv_usec

See merge request GNOME/glib!3178
2023-01-05 14:40:15 +00:00
Philip Withnall
35d3528623 Merge branch '2857-stpcpy-doc' into 'main'
gstrfuncs: Fix grammar in documentation of stpcpy

Closes #2857

See merge request GNOME/glib!3179
2023-01-05 14:21:04 +00:00