Commit Graph

30837 Commits

Author SHA1 Message Date
Matthias Clasen
5d986fd42a dir: Avoid some allocations
If no error is passed, we don't need to do charset conversions.
2024-09-06 10:49:31 -04:00
Philip Withnall
68a9b9d3ca
gresource: Split g_resource_lookup_data() into two internal helpers
It’s now a call to `do_lookup()` followed by a call to
`resource_to_bytes()`. This makes no functional changes, but will be
useful in the following commit.

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

Helps: #3465
2024-09-05 12:14:15 +01:00
Philip Withnall
87af31604b
gresource: Remove unnecessary errors from g_resources_get_info()
As with the previous commit:

The error here can only ever be `G_RESOURCE_ERROR_NOT_FOUND`, which
`g_resources_get_info()` immediately frees. So let’s avoid allocating
the error in the first place.

Spotted by Christian Hergert.

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

Helps: #3465
2024-09-05 12:09:21 +01:00
Philip Withnall
77ba62c832
gresource: Remove unnecessary errors from g_resources_open_stream()
The error here can only ever be `G_RESOURCE_ERROR_NOT_FOUND`, which
`g_resources_open_stream()` immediately frees. So let’s avoid allocating
the error in the first place.

Spotted by Christian Hergert.

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

Helps: #3465
2024-09-05 12:03:18 +01:00
Philip Withnall
a839737fc8
gresource: Factor out common error setting code
This makes it a bit easier to make sure all the translatable strings are
kept in sync. It introduces no functional changes.

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

Helps: #3465
2024-09-05 12:01:14 +01:00
Philip Withnall
ced5c6d960 Merge branch 'main' into 'main'
Update Galician translations for main

See merge request GNOME/glib!4239
2024-09-04 12:07:14 +00:00
Fran Diéguez
1360d47138 Update gl.po 2024-09-04 09:56:45 +00:00
Philip Withnall
2c7624fafb Merge branch 'translation/main/fr_FR' into 'main'
Update French translation

See merge request GNOME/glib!4237
2024-09-03 15:07:47 +00:00
Vincent Chatelain
d6acea5de5 Update french translation 2024-09-03 11:06:25 +00:00
Philip Withnall
85286f4f57 Merge branch 'cherry-pick-4229-4234-translations-main' into 'main'
Cherry pick Polish and Brazilian Portuguese translations from glib-2-82 to main

See merge request GNOME/glib!4236
2024-09-03 09:36:52 +00:00
Rafael Fontenelle
1cf1b2f04b Update Brazilian Portuguese translation 2024-09-03 10:06:34 +01:00
Piotr Drąg
1df8df0cce Update Polish translation 2024-09-03 10:06:34 +01:00
Philip Withnall
396ffaa9ba Merge branch 'update_uk1' into 'main'
Update Ukrainian translation

See merge request GNOME/glib!4235
2024-09-03 08:54:47 +00:00
Yuri Chornoivan
485002bd2e Update Ukrainian translation 2024-09-02 21:55:28 +03:00
Philip Withnall
8fdb8c44c3 Merge branch 'mcatanzaro/gspawn-close' into 'main'
gspawn: close child_err_report_fd before exiting on error

See merge request GNOME/glib!4227
2024-09-01 17:43:48 +00:00
Philip Withnall
f505d3df98 Merge branch 'cs-update' into 'main'
Update Czech translation

See merge request GNOME/glib!4225
2024-09-01 17:33:12 +00:00
Philip Withnall
007879405c Merge branch 'patch-pt-1' into 'main'
Update Portuguese translation

See merge request GNOME/glib!4226
2024-09-01 17:27:41 +00:00
Hugo Carvalho
a0fa016c64 Update Portuguese translation 2024-09-01 18:17:42 +01:00
Michael Catanzaro
ddeb4a211b gspawn: close child_err_report_fd before exiting on error
When the child process is going to exit on error after fork() but before
exec(), let's close the child_err_report_fd. The practical value of this
is to placate valgrind --track-fds=yes.
2024-08-30 11:42:12 -05:00
AsciiWolf
18f8588d4f Update Czech translation 2024-08-30 12:18:33 +02:00
Philip Withnall
58844c7919 Merge branch 'catalan' into 'main'
Update Catalan translation

See merge request GNOME/glib!4224
2024-08-30 08:00:29 +00:00
Philip Withnall
cc4673d791 Merge branch '20240830-update-ko' into 'main'
Update Korean translation

See merge request GNOME/glib!4223
2024-08-30 07:59:30 +00:00
Jordi Mas
cb7b650205 Update Catalan translation 2024-08-30 06:09:59 +02:00
Changwoo Ryu
4205d1b9f4 Update Korean translation 2024-08-30 09:00:00 +09:00
Emmanuele Bassi
14ed56fde8 Merge branch '3460-readme-link' into 'main'
docs: Clarify link in README.md

Closes #3460

See merge request GNOME/glib!4222
2024-08-29 08:35:46 +00:00
Philip Withnall
0df6e9d684
docs: Clarify link in README.md
The new merge request link only works when logged in to a GitLab
account, unfortunately. Make that clear in the readme.

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

Fixes: #3460
2024-08-29 08:58:36 +01:00
Philip Withnall
6c41e77913 Merge branch 'bash' into 'main'
tests: Run lint tests with detected bash

See merge request GNOME/glib!4219
2024-08-28 09:49:35 +00:00
Michael Catanzaro
42802d32de Merge branch '3456-mountinfo-files-in-tests' into 'main'
tests: Test against a sample mtab file in unix-mounts for getmntent()

Closes #3456

See merge request GNOME/glib!4217
2024-08-27 18:46:02 +00:00
Benjamin Gilbert
ca77a1625d tests: Run lint tests with detected bash
When we invoke a shell script directly, the system selects a bash binary
that might be different from the one detected by find_program('bash').
Explicitly use the one detected by Meson, matching the behavior of our
other test() invocations on shell scripts.

Fixes test failure on Windows in GitHub Actions CI:

    stdout: 1: UNKNOWN: Windows Subsystem for Linux has no installed distributions.
    stdout: 2: UNKNOWN: Distributions can be installed by visiting the Microsoft Store:
    stdout: 3: UNKNOWN: https://aka.ms/wslstore

Found-by: Benoit Pierre <benoit.pierre@gmail.com>
Fixes: d7601f7eed ("Incorporate some lint checks into `meson test`")
2024-08-27 11:40:18 -07:00
Philip Withnall
43940d88f4 Merge branch 'persian-l10n' into 'main'
Persian l10n

See merge request GNOME/glib!4218
2024-08-27 15:26:55 +00:00
Danial Behzadi
687b8fac1b Persian l10n 2024-08-27 15:26:55 +00:00
Philip Withnall
2135a2419d Merge branch 'wip/chergert/g_ref_string_equal' into 'main'
refstring: add GEqualFunc for ref-counted strings

See merge request GNOME/glib!4196
2024-08-27 13:51:06 +00:00
Philip Withnall
27c02a0be4
tests: Test against a sample mtab file in unix-mounts for getmntent()
The test in `unix-mounts` to see whether `g_unix_mounts_get_from_file()`
can parse an example file was working fine when GLib is built with
libmount, but not when built without it (and hence typically using
`getmntent()`).

This is because libmount supports mountinfo files (like
`/proc/self/mountinfo`), but `getmntent()` only supports mount files
(like `/proc/mounts`). The test was written only with the former.

So, change the test to use mount files when GLib is built without
libmount support.

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

Fixes: #3456
2024-08-27 12:13:35 +01:00
Christian Hergert
6ad7bcfc36 refstring: add GEqualFunc for ref-counted strings
This is the same as g_str_equal() except that it will first check the
string length for equality before dereferencing string contents.
2024-08-27 11:36:21 +01:00
Philip Withnall
c242972043 Merge branch 'ewlsh/gi-async-function-annotations' into 'main'
girepository: Add APIs for sync, async, and finish function annotations

See merge request GNOME/glib!3746
2024-08-26 16:40:54 +00:00
Philip Withnall
bfd1d73841 Merge branch 'version-bump' into 'main'
build: Post-release version bump

See merge request GNOME/glib!4216
2024-08-26 11:22:30 +00:00
Philip Withnall
e6c26caf44
ci: Also build gobject-introspection in test-msys2.sh
The build instructions for msys2 builds are stored outwith
`.gitlab-ci.yml`.

We need to build a specific (recent) version of gobject-introspection so
we can get support for async annotations in `g-ir-scanner`. See !3746.

Fixes commit 93271385f9.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:44 +01:00
Philip Withnall
39671c196d
girepository: Fix hole in GIFunctionInfoFlags
It’s unclear why there was a hole in this. Let’s keep things less
confusing by eliminating it.

Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:28 +01:00
Philip Withnall
0a60b57fd4
girepository: Fix API version ‘since’ numbers
Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:13 +01:00
Philip Withnall
10177cf3ea
girepository: Coding style fixes
Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:07:49 +01:00
Evan Welsh
453dd4be9e girepository: Add APIs for sync, async, and finish function annotations 2024-08-26 12:07:25 +01:00
Evan Welsh
93271385f9 ci: Set gobject-introspection version and build gobject-introspection in tests
The minimum version is now 1.80.0
2024-08-26 12:07:25 +01:00
Philip Withnall
b0ac7acb8e Merge branch 'wip/pwithnall/3415-freebsd-gmodule' into 'main'
Revert "gmodule-dl: Use RTLD_DEFAULT on FreeBSD too"

Closes #3415

See merge request GNOME/glib!4199
2024-08-26 10:36:20 +00:00
Philip Withnall
ea44c0e4e0
build: Post-release version bump
This opens up the development cycle for 2.84.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 10:42:32 +01:00
Philip Withnall
593b88bf1f Merge branch '3417-mutex-speedup' into 'main'
gthread: Move thread _impl functions to static inlines for speed

Closes #3417

See merge request GNOME/glib!4214
2024-08-26 07:35:58 +00:00
Philip Withnall
aec5785e7b
gthread: Move thread _impl functions to static inlines for speed
The changes made in commit bc59e28bf6
(issue #3399) fixed introspection of the GThread API. However, they
introduced a trampoline in every threading function. So with those
changes applied, the disassembly of `g_mutex_lock()` (for example) was:
```
0x7ffff7f038b0 <g_mutex_lock>    jmp 0x7ffff7f2f440 <g_mutex_lock_impl>
0x7ffff7f038b5                   data16 cs nopw 0x0(%rax,%rax,1)
```

i.e. It jumps straight to the `_impl` function, even with an optimised
build. Since `g_mutex_lock()` (and various other GThread functions) are
frequently run hot paths, this additional `jmp` to a function which has
ended up in a different code page is a slowdown which we’d rather avoid.

So, this commit reworks things to define all the `_impl` functions as
`G_ALWAYS_INLINE static inline` (which typically expands to
`__attribute__((__always_inline__)) static inline`), and to move them
into the same compilation unit as `gthread.c` so that they can be
inlined without the need for link-time optimisation to be enabled.

It makes the code a little less readable, but not much worse than what
commit bc59e28bf6 already did. And perhaps
the addition of the `inline` decorations to all the `_impl` functions
will make it a bit clearer what their intended purpose is
(platform-specific implementations).

After applying this commit, the disassembly of `g_mutex_lock()`
successfully contains the inlining for me:
```
=> 0x00007ffff7f03d80 <+0>:	xor    %eax,%eax
   0x00007ffff7f03d82 <+2>:	mov    $0x1,%edx
   0x00007ffff7f03d87 <+7>:	lock cmpxchg %edx,(%rdi)
   0x00007ffff7f03d8b <+11>:	jne    0x7ffff7f03d8e <g_mutex_lock+14>
   0x00007ffff7f03d8d <+13>:	ret
   0x00007ffff7f03d8e <+14>:	jmp    0x7ffff7f03610 <g_mutex_lock_slowpath>
```

I considered making a similar change to the other APIs touched in #3399
(GContentType, GAppInfo, GSpawn), but they are all much less performance
critical, so it’s probably not worth making their code more complex for
that sake.

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

Fixes: #3417
2024-08-25 21:56:14 +01:00
Philip Withnall
f92da0cb49 Merge branch '3421-glib_debug-docs' into 'main'
docs: Set -Dglib_debug=enabled by default and document it for distros

Closes #3421

See merge request GNOME/glib!4212
2024-08-25 18:51:13 +00:00
Philip Withnall
b02e29558f
docs: Set -Dglib_debug=enabled by default and document it for distros
As per https://gitlab.gnome.org/GNOME/glib/-/issues/3421#note_2206315:

It seems like there’s agreement that glib_debug should be enabled for
developers and disabled for distros; and it also seems like there’s no
reliable way to figure this out magically (because not everyone ties
things to `-Dbuildtype=*`). So, we’re left with forcing some group of
people to manually set the value of `glib_debug`. There are more
developers/contributors than there are distros, and distros are more
likely to notice an accidentally-slow GLib package than developers are
likely to notice an accidentally-not-asserting-hard-enough local build,
so let’s say:

The default should be `-Dglib_debug=enabled`, and distros should probably
all override that to `-Dglib_debug=disabled`.

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

Fixes: #3421
2024-08-25 18:34:05 +01:00
Philip Withnall
94078c9f96
meson: Fix reference to docs/macros.md in meson.options
It was renamed from `macros.txt` a while ago.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-25 18:25:51 +01:00
Michael Catanzaro
e5997f1eac Merge branch '3451-ui-example' into 'main'
gmenumodel: Acknowledge in docs that the UI used in the example is old

Closes #3451

See merge request GNOME/glib!4210
2024-08-25 17:21:20 +00:00