Commit Graph

23573 Commits

Author SHA1 Message Date
Dan Williams
9cb1bb0fb2 Add g_prefix_error_literal()
Because sometimes you don't want a lone "%s", and you don't
want the compiler yelling at you about format strings that
don't have any format in them.

Closes #663
2021-05-28 17:15:46 +02:00
Sebastian Dröge
0d7f3e74e0 Merge branch '399-dlerror-thread-safety' into 'master'
gmodule: Add locking around dlerror() for some libc implementations

Closes #399

See merge request GNOME/glib!2122
2021-05-28 10:02:59 +00:00
Philip Withnall
483843c282 gmodule: Add locking around dlerror() for some libc implementations
Specifically, for uclibc at the moment. Other implementations may need
locking, but I haven’t checked any aside from uclibc-ng and glibc.

POSIX.1-2001 specifies that `dlerror()` is not thread-safe, but the
glibc (and likely other libc) implementation is.

Issue #399 was originally reported about eglibc, but that project has
since died and been merged back into glibc. So that’s one less thing to
worry about.

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

Fixes: #399
2021-05-28 09:58:21 +01:00
Jasper St. Pierre
edb40c7171 gobject: Allow passing %NULL for @data in g_object_remove_toggle_ref
gjs has some situations where it's not always aware of the @data that
was passed into g_object_add_toggle_ref, so allow passing %NULL to
just match on @notify.

Rebased and updated by Nitin Wartkar

Closes #817
2021-05-27 21:09:45 +05:30
Philip Withnall
73a78f7470 gmodule: Add some missing consts
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-27 13:46:28 +01:00
Philip Withnall
0c8740dc83 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2106
2021-05-27 10:00:28 +00:00
Emmanuel Fleury
bf536a5ce2 Fix incompatible pointer to integer conversion warning in glib/tests/atomic.c
lib/tests/atomic.c:115:9: warning: incompatible pointer to integer conversion passing 'void *' to parameter of type 'gsize' (aka 'unsigned long')
  res = g_atomic_pointer_compare_and_exchange (&gs, NULL, NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glib/gatomic.h:225:34: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
                                 (newval), FALSE,                            \
                                 ^~~~~~~~
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
2b4bf535f1 Fix discard qualifier warning in glib/tests/atomic.c
glib/tests/atomic.c:132:18: warning: passing 'typeof (*(cspp)) *' (aka 'const int *const *') to parameter of type 'const gint **' (aka 'const int **') discards qualifiers
  g_assert_true (g_atomic_pointer_get (cspp) == csp);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
glib/gatomic.h:117:38: note: expanded from macro 'g_atomic_pointer_get'
    __atomic_load (gapg_temp_atomic, (&(gapg_temp_newval)), __ATOMIC_SEQ_CST); \
                                     ^~~~~~~~~~~~~~~~~~~~~
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
a369efd207 Fix missing initializer warning in tests/slice-threadinit.c
tests/slice-threadinit.c:34:30: warning: missing field 'sample' initializer
} pages[N_PAGES] = { { NULL, }, };
                             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
aace697d7e Fix missing initializer warning in gio/tests/gdbus-exit-on-close.c
gio/tests/gdbus-exit-on-close.c:52:14: warning: missing field 'bug' initializer
      { NULL }
             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
652a7b7db1 Fix missing initializer warnings in gio/tests/socket.c
gio/tests/socket.c:505:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:630:37: warning: missing field 'vectors' initializer
    GOutputMessage m[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:631:37: warning: missing field 'vectors' initializer
    GInputMessage im[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:632:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:633:36: warning: missing field 'size' initializer
    GInputVector iv[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:871:32: warning: missing field 'vectors' initializer
    GInputMessage im = { NULL, };
                               ^
gio/tests/socket.c:872:31: warning: missing field 'size' initializer
    GInputVector iv = { NULL, };
                              ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
bee07cebcd Fix missing initializer warning in gobject/gtype.c
gobject/gtype.c:1103:55: warning: missing field 'value_free' initializer
          static const GTypeValueTable zero_vtable = { NULL, };
                                                             ^
2021-05-27 10:16:52 +02:00
Philip Withnall
4575c70a6b Merge branch 'strv_builder_add_many' into 'master'
gstrvbuilder: add addv and add_many to the API

See merge request GNOME/glib!2112
2021-05-26 12:41:19 +00:00
alex-tee
232b40da7b gstrvbuilder: add addv and add_many to the API 2021-05-26 12:41:18 +00:00
Philip Withnall
d64d46dc42 Merge branch 'macos-static-libintl' into 'master'
meson: Fix detection of static libintl on macOS

See merge request GNOME/glib!2109
2021-05-17 14:07:44 +00:00
Philip Withnall
f71faad46b Merge branch 'th/gdbus-doc-unsubscribe-idle' into 'master'
gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()

See merge request GNOME/glib!2050
2021-05-17 10:49:38 +00:00
Philip Withnall
62571c71b5 Merge branch 'Docs' into 'master'
docs: Improved documentation of GNotification

Closes #2405

See merge request GNOME/glib!2102
2021-05-17 10:30:55 +00:00
Nitin Wartkar
e727a69a8b docs: Improved documentation of GNotification 2021-05-17 10:30:54 +00:00
Philip Withnall
b4522e680c Merge branch 'helper-getters' into 'master'
docs: Improved the docs of helper getters optimization in g_file_info.c

Closes #310

See merge request GNOME/glib!2107
2021-05-17 09:29:13 +00:00
nitinosiris
69be87dda1 docs: Improved the docs of helper getters optimization in g_file_info.c
g_file_info_get_name() gives result faster than g_file_info_get_attribute_byte_string()

Closes #310
2021-05-17 14:26:17 +05:30
Jonas Hahnfeld
c6ce891376 meson: Fix detection of static libintl on macOS
If libintl is built statically on macOS, linking it requires passing
"-framework CoreFoundation" to satisfy symbol dependencies. Use the
available osx_ldflags already detected earlier in the process.
2021-05-16 11:58:26 +02:00
Philip Withnall
c3b11c64ee Merge branch 'test-F_DUPFD_CLOEXEC' into 'master'
glib spawn-singlethread test only if F_DUPFD_CLOEXEC is defined

See merge request GNOME/glib!2108
2021-05-14 18:51:49 +00:00
Claes Nästén
d3207660bb glib spawn-singlethread test only if F_DUPFD_CLOEXEC is defined
F_DUPFD_CLOEXEC is not available on Solaris 10, no need to fail the
build instead skip the test as on non Unix platforms already.
2021-05-14 20:24:10 +02:00
Philip Withnall
e944cf8b1c Merge branch 'bookmarkfile-crash' into 'master'
gbookmarkfile: Don't crash if we're not visited

See merge request GNOME/glib!1514
2021-05-13 22:33:40 +00:00
Philip Withnall
87e994ef48 Merge branch '1036-dbus-proxy-docs' into 'master'
gdbusproxy: Recommend it is not used for stateless services

Closes #1036

See merge request GNOME/glib!386
2021-05-13 22:25:21 +00:00
Emmanuele Bassi
2910ffd383 Merge branch 'test-bug-numbers' into 'master'
tests: Drop use of g_test_bug_base()

See merge request GNOME/glib!2104
2021-05-13 21:56:15 +00:00
Matthias Clasen
f3e65b1af7 gbookmarkfile: Don't crash if we're not visited
Rewrite bookmark_item_dump to not crash if any of
the timestamps is NULL. Also, avoid some of the gratitious
extra string copying.

Tweaked by Philip Withnall to pass the unit tests.
2021-05-13 22:50:34 +01:00
Philip Withnall
43c28fcd5a gdbusproxy: Recommend it is not used for stateless services
For the reasons given in the new bit of documentation, GDBusProxy should
not be used for connecting to stateless D-Bus services which may be
restarted at any point.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1036
2021-05-13 22:24:26 +01:00
Philip Withnall
7e9585177d tests: Drop use of g_test_bug_base()
Include the base URI in the `g_test_bug()` calls instead. This resolves
inconsistencies between the old bug base (bugzilla.gnome.org) and the
new bug base (gitlab.gnome.org). It also has the advantage that the URI
passed to `g_test_bug()` is now clickable in the code editor, rather
than being split across two locations.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 22:16:27 +01:00
Philip Withnall
46ab6821a3 gtestutils: Allow full URIs in g_test_bug()
Even if `g_test_bug_base()` has been called.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 21:57:40 +01:00
Philip Withnall
0f7950f199 gtestutils: Improve documentation formatting for g_test_bug_base()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 21:57:25 +01:00
Philip Withnall
3bca6ee2e4 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2101
2021-05-13 20:16:46 +00:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Philip Withnall
82e2517257 Merge branch 'carlosgc/remove-dot-segments' into 'master'
guri: always apply the remove dot segments algorithm

Closes #2342

See merge request GNOME/glib!2084
2021-05-13 13:13:34 +00:00
Philip Withnall
53834ee319 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings (clang)

See merge request GNOME/glib!2091
2021-05-13 12:04:42 +00:00
Philip Withnall
56ddba7c34 Merge branch 'serializ' into 'master'
docs: Standardize spelling of serializ*

Closes #2399

See merge request GNOME/glib!2096
2021-05-13 11:37:11 +00:00
Emmanuel Fleury
82fc86dcd4 Fix missing initializer warning in gio/gio-tool-info.c
gio/gio-tool-info.c:41:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
8a3e184db9 Fix missing initializer warning in gio/gio-tool-copy.c
gio/gio-tool-copy.c:50:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c395e865bf Fix missing initializer warning in gio/gio-tool-cat.c
gio/gio-tool-cat.c:42:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
27454ed557 Fix missing initializer warning in gio/glib-compile-schemas.c
gio/glib-compile-schemas.c:2181:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
4301110174 Fix missing initializer warning in gio/tests/socket-client.c
gio/tests/socket-client.c:37:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
689b9b545f Fix missing initializer warning in gio/tests/socket-server.c
gio/tests/socket-server.c:43:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
66af256621 Fix missing initializer warning in glib/tests/spawn-path-search-helper.c
glib/tests/spawn-path-search-helper.c:82:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f9904fe7ae Fix missing initializers warnings in glib/tests/utf8-validate.c
glib/tests/utf8-validate.c:271:11: warning: missing field 'max_len' initializer
  { NULL, }
          ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c65ec0bfbf Fix many missing initializers warnings in glib/tests/option-context.c
glib/tests/option-context.c:36:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
glib/tests/option-context.c:43:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
glib/tests/option-context.c:319:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
...
           ^
glib/tests/option-context.c:2538:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
glib/tests/option-context.c:2576:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f2d14a8770 Fix missing field initializer warning in glib/tests/option-argv0.c
glib/tests/option-argv0.c:38:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
2e4524cd36 Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays 2021-05-13 12:57:06 +02:00
Philip Withnall
c0b339372c Merge branch 'mcatanzaro/string-test' into 'master'
tests: Add missing return value check in string test

See merge request GNOME/glib!2100
2021-05-11 22:27:44 +00:00
Philip Withnall
940613e598 Merge branch 'gmacros-gnoreturn-cleanup' into 'master'
gmacros.h: G_NORETURN: remove useless checks

See merge request GNOME/glib!2099
2021-05-11 22:26:44 +00:00
Michael Catanzaro
82d162da83 tests: Add missing return value check in string test
Coverity noticed that we were not testing the return value here. Good
Coverity!
2021-05-11 16:24:39 -05:00