Commit Graph

26224 Commits

Author SHA1 Message Date
Xavier Claessens
6e341750df g_str_equal: Provide macro for optimization
g_str_equal() is a nicer API than strcmp()==0, and less error prone.
However, forcing a function call prevents compiler from doing
optimizations. In the case it is not used as callback to GHashTable,
provide a macro that calls strcmp directly. This also has the side
effect that it forces arguments to be `const char *` instead of
`gconstpointer` in the case it is not used as callback, which adds type
safety.

Fixes: #2775
2022-10-11 10:55:56 -04:00
Marco Trevisan
cf4d8a3bdc Merge branch 'osx-declaration-mixes-fix' into 'main'
gosxcontenttype: Do not mix declarations with code

Closes #2759

See merge request GNOME/glib!2909
2022-10-11 13:24:57 +00:00
Marco Trevisan
10e3715bc1 Merge branch 'utimensat2' into 'main'
glocalfileinfo: In set_mtime_atime(), don't use utimensat() if it's not available

See merge request GNOME/glib!2911
2022-10-11 13:11:07 +00:00
Marco Trevisan (Treviño)
60587d5965 tests/file: Include config.h so tests checking HAVE_* definitions are ran
We have tests depending on HAVE_UTIMES and HAVE_UTIMENSAT that were
currently not compiled because these were always undefined
2022-10-11 14:37:12 +02:00
Marco Trevisan (Treviño)
b1d4b4bb3b glocalfileinfo: Avoid getting unused type values 2022-10-11 14:24:17 +02:00
Jared Wahlstrand
15cb123c82 glocalfileinfo: don't call both utimes and utimensat
also split us precision and ns precision code to make this cleaner
2022-10-11 14:10:28 +02:00
Marco Trevisan
4231426abe Merge branch 'optimize_g_double_hash' into 'main'
Optimize the implementation of `g_double_hash`

See merge request GNOME/glib!2924
2022-10-11 11:26:41 +00:00
星外之神
e02db8ea22 Add tests for hash collisions in simple cases 2022-10-11 13:12:20 +02:00
wszqkzqk
c1af4b2b88 Optional optimization for g_int64_hash 2022-10-11 13:12:20 +02:00
wszqkzqk
dd1f4f709e Optimize g_double_hash implementation 2022-10-11 13:12:20 +02:00
Marco Trevisan (Treviño)
80cf66034b gobject/tests/param: Add unit test for handling invalid NULL param spec
This was fixed by !2921 but there was no test with the MR, so add one.
2022-10-10 21:01:10 +02:00
Marco Trevisan
db259b5925 Merge branch 'atime' into 'main'
tests: skip g-file-info test if atime unsupported

See merge request GNOME/glib!2866
2022-10-10 15:32:06 +00:00
Marco Trevisan
cc02e8720d Merge branch 'unicode-15' into 'main'
Unicode 15 support

Closes #2735

See merge request GNOME/glib!2877
2022-10-10 14:20:17 +00:00
Marco Trevisan
8f2711bf72 Merge branch 'log-field-nul-termination-2' into 'main'
Update version in the docs to 2.74.1 for the fixed handling of...

See merge request GNOME/glib!2916
2022-10-10 12:33:57 +00:00
Philip Withnall
1d2ea6518c Merge branch 'fix-unix-streams-error-leak' into 'main'
tests/unix-streams: Free the cancelled error on cancelled cancellable

See merge request GNOME/glib!2892
2022-10-10 12:02:56 +00:00
Philip Withnall
b321ba1d1f Merge branch 'ignore-dirs-leaks+valgrind-ci' into 'main'
glib.supp: Ignore gutils leaks for user and system dirs

Closes #333

See merge request GNOME/glib!2897
2022-10-10 12:01:49 +00:00
Sebastian Dröge
aaf1bc0331 Merge branch 'fix-localfileinfo' into 'main'
gio: properly guard use of utimensat()

Closes #2766

See merge request GNOME/glib!2914
2022-10-10 06:57:48 +00:00
Sebastian Dröge
2f284193a7 Merge branch 'date-time-new-now' into 'main'
gdatetime: add NULL guard in g_date_time_new_now()

See merge request GNOME/glib!2938
2022-10-10 06:52:56 +00:00
Peter Bloomfield
574a2ecfa9 gdatetime: add NULL guard in g_date_time_new_now()
Add a missing g_return_() check in g_date_time_new_now().
A clear warning is better than a NULL pointer dereference.
2022-10-09 19:39:58 -04:00
Emmanuele Bassi
3b7af4dd5d gtype: Use the system allocator on UNIX
Instead of replacing the slice allocator wholesale, we can start phasing
it out by having GTypeInstance use the system allocator on operating
systems where we can assume good performance profiles.

We cannot commit to fully gutting GSlice in the cases where we might
still need it, like the G(S)List allocator and small, similarly-sized
data structures.

The main user of GSlice is still GTypeInstance/GObject, and those have
moved out of the sweet spot of GSlice's performance envelove over the
years, with larger instance sizes and private data.

See: #1079
2022-10-07 15:54:11 +01:00
Marco Trevisan (Treviño)
5a6ce16142 gicon: Do not mark g_icon_to_string() as to_tokens() invoker
That's not strictly true as they've different signature, and this leads
to some introspection and documentation errors.
2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
c3ebf6cdca gicon: Add virtual invokers for equal() and serialize() 2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
7ea5e4c293 gicon: Force g_icon_hash argument to be Gio.Icon for bindings 2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
19cfc55847 gicon: Add introspection for to_tokens / from_tokens vfunc's
The GIconIface virtual functions were not introspectable as they use
complex parameters that GI isn't able to compute alone.

So provide introspection metadata to the two function pointers
definitions.

GIcon::from_tokens is a static virtual function so it won't actually
work until GI support for it [1] is merged.

[1] https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/361
2022-10-06 17:25:10 +02:00
Yaron Shahrabani
2b8b866bae Update Hebrew translation 2022-10-06 13:23:20 +00:00
Sebastian Dröge
07e3ec6e04 Merge branch 'aleksander/gdatetime-return-if-fail' into 'main'
gdatetime: add missing g_return_() check in g_date_time_format_iso8601

See merge request GNOME/glib!2931
2022-10-05 07:09:47 +00:00
AJ Jordan
e052dddd1d Fix style warning in gvariant.c 2022-10-05 06:47:26 +00:00
Aleksander Morgado
737ca7de91 gdatetime: add missing g_return_() check in g_date_time_format_iso8601
A clear warning is better than a NULL pointer dereference.

Signed-off-by: Aleksander Morgado <aleksandermj@chromium.org>
2022-10-04 21:37:58 +00:00
Quentin PAGÈS
f5a51089d8 Update Occitan translation 2022-10-04 17:40:02 +00:00
Fabio Tomat
e3c56a2f65 Update Friulian translation 2022-10-03 09:09:10 +00:00
Xavier Claessens
2843eef4a4 Merge branch 'gbsneto/python-find' into 'main'
build: Let Meson figure out Python installation

See merge request GNOME/glib!2928
2022-09-30 12:57:58 +00:00
Georges Basile Stavracas Neto
255fa26b96 build: Let Meson figure out Python installation
Commit 4a4d9eb662 initially switched Meson to find the python
program using find_program('python3'). Sadly that caused a
regression, since in some cases with MSVC it would fallback to
'meson.exe runpython', which is undesired.

However, that particular code was reverted back to an also
undesired lookup method, find_installation('python3'). This
way of finding python also breaks on Windows + MSVC, in particular
when setting it up as follows:

```
winget install python
winget install meson
```

This fails building GLib with:

> python3 not found

Fix that by not passing any argument to find_installation(), which
lets Meson figure it all out by itself.
2022-09-29 17:18:10 -03:00
Nart Tlisha
274761d68f Update Abkhazian translation 2022-09-29 15:32:11 +00:00
Fabio Tomat
ce48bf1abd Update Friulian translation 2022-09-28 08:38:58 +00:00
Marco Trevisan
df8403eec4 Merge branch 're-js-compat' into 'main'
gregex: Allow G_REGEX_JAVASCRIPT_COMPAT in compile mask

See merge request GNOME/glib!2920
2022-09-27 14:29:59 +00:00
Guido Günther
664ee9ca6a gregex: Drop explanation G_REGEX_JAVASCRIPT_COMPAT
It's not supported as of glib 2.74
2022-09-27 13:52:05 +02:00
Guido Günther
a164b49532 gregex: Allow G_REGEX_JAVASCRIPT_COMPAT in compile mask for g_regex_new
The flag is still ignored but this way we properly deprecate
at compile time without raising an unexpected criticals at runtime:

   g_regex_new: assertion '(compile_options & ~G_REGEX_COMPILE_MASK) == 0' failed

and then failing to create the regex completely.

Fixes 8d5a44dc8 ("replace pcre1 with pcre2")
2022-09-27 13:52:05 +02:00
Emmanuele Bassi
f0dd96c287 Merge branch 'ebassi/issue-2770' into 'main'
Empty values are not valid GParamSpec

Closes #2770

See merge request GNOME/glib!2921
2022-09-25 19:41:00 +00:00
Emmanuele Bassi
0b43858f46 Merge branch 'ebassi/fix-python-style-check' into 'main'
ci: Conform to Python's coding style

See merge request GNOME/glib!2922
2022-09-25 19:40:10 +00:00
Emmanuele Bassi
8f975d07f3 ci: Conform to Python's coding style
The check-missing-install-tag.py script breaks PEP8, and the style check
CI job complains about it.
2022-09-25 18:51:22 +01:00
Emmanuele Bassi
ea3f17d598 Empty values are not valid GParamSpec
The validate() vfunc for GParamSpecParam returns FALSE for empty GValue,
which means the is_valid() vfunc should do the same.

This avoids a segfault when calling g_param_value_is_valid() on a
GParamSpecParam.

Fixes: #2770
2022-09-25 14:20:24 +01:00
Christian Kirbach
d2818c2033 Update German translation 2022-09-24 21:44:20 +00:00
Sebastian Dröge
54abb0f17b Update version in the docs to 2.74.1 for the fixed handling of non-NUL-terminated structured logging strings 2022-09-22 15:57:01 +03:00
Matthias Clasen
4e61dbc07b Merge branch 'log-field-nul-termination' into 'main'
Consider the GLogField.length of "MESSAGE"/"GLIB_DOMAIN" fields in g_log_writer_format_fields()

See merge request GNOME/glib!2915
2022-09-22 12:37:41 +00:00
Sebastian Dröge
cfdcdaacc1 Consider the GLogField.length of "MESSAGE"/"GLIB_DOMAIN" fields in g_log_writer_format_fields()
Previously it was wrongly assuming that a NUL-termianted string is
passed and the whole string should be written out.

Also document this bug in the documentation of g_log_structured() to
avoid surprises when using older GLib versions.
2022-09-22 15:09:56 +03:00
Peter Williams
7f7171e68a gio: properly guard use of utimensat()
Closes #2766.
2022-09-21 11:56:33 -04:00
Marco Trevisan (Treviño)
0f869ec5c6 regex: Use critical messages if an unexpected NULL parameter is provided
As programmer error we should be consistent in using criticals.
2022-09-21 13:48:18 +02:00
Marco Trevisan (Treviño)
6caf952e48 gregex: Use pcre2 error messages if we don't provide a specific one
In case we got a compilation or match error we should try to provide
some useful error message, if possible, before returning a quite obscure
"internal error" or "unknown error" string.

So rely on PCRE2 strings even if they're not translated they can provide
better information than the ones we're currently giving.

Related to: https://gitlab.gnome.org/GNOME/glib/-/issues/2691
Related to: https://gitlab.gnome.org/GNOME/glib/-/issues/2760
2022-09-21 13:47:56 +02:00
Simon McVittie
831f5c5c2d tests: Run all tests with deprecated property warnings enabled
The tests that functionally rely on G_ENABLE_DIAGNOSTIC=1 still set it
explicitly, so that they will behave as expected when run as
installed-tests or manually.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:20:34 +01:00
Simon McVittie
7254fd7aa3 gobject/tests: Don't unref a floating object reference by mistake
This goes undiagnosed under normal circumstances, but is a critical
warning (which is fatal by default) under G_ENABLE_DIAGNOSTIC. This is a
programming error, so we should only exercise it under
g_test_undefined(), and only in a test that is intentionally doing this
(as in the previous commit).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:19:52 +01:00