Commit Graph

24007 Commits

Author SHA1 Message Date
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
Philip Withnall
447f727284 tests: Use a temporary file in the bookmarkfile tests
Rather than always writing to `out.xbel` in the build directory, which
could cause issues when running tests in parallel, or expecting the
tests to not touch the build directory.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 22:53:38 +01: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
Aleksandr Mezin
55f13da1f5 gmacros.h: G_NORETURN: remove useless checks
GCC >= 2.8 and MSVC >= 1200 are already handled by `#if` branches above. So:

- `(__GNUC__ == 4 && __GNUC_MINOR__ >= 7)` is always false here

- `!(__GNUC__ == 4 && __GNUC_MINOR__ == 7)` is always true

- `(_MSC_VER >= 1900)` is always false
2021-05-11 22:27:40 +06:00
Philip Withnall
4cd1a1c03d Merge branch 'optimise_g_atomic_ref_count_dec' into 'master'
grefcount: Optimise g_atomic_ref_count_dec

See merge request GNOME/glib!2098
2021-05-11 11:00:26 +00:00
Nishal Kulkarni
8cba1f4c17 grefcount: Optimise g_atomic_ref_count_dec
Currently, `g_atomic_ref_count_dec ()` does two operations.
We try to get this down to one operation.

Replace `g_atomic_int_dec_and_test ()` with `g_atomic_int_add ()`
Passing -1 as value.

Note: changes current behaviour, checks are now done after decrement.
2021-05-11 15:08:20 +05:30
Sebastian Dröge
ea4721422f Merge branch 'optimise_gatomicrefcount' into 'master'
grefcount: Optimise g_atomic_ref_count_inc

Closes #1583

See merge request GNOME/glib!2086
2021-05-11 07:27:24 +00:00
Geyslan G. Bem
6b867cd474 docs: Standardize spelling of serializ*
Changes serialis* to serializ*.

Fixes: #2399

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-10 15:28:12 -03:00
Philip Withnall
e8329b5219 Merge branch 'mywork' into 'master'
glib: Improved documentation of GSourceFuncs

Closes #1864

See merge request GNOME/glib!2095
2021-05-10 15:15:58 +00:00
nitinosiris
15e3b9e219 glib: documentation of GSourceFuncs
Only finalize has a comment to indicate that it can be NULL
However, prepare and check can both be NULL too.

Fixes: 1864
2021-05-10 20:03:12 +05:30
Philip Withnall
2549187b18 Merge branch 'windows-known-folders' into 'master'
Use SHGetKnownFolderPath() on Windows

Closes #2397

See merge request GNOME/glib!2089
2021-05-10 14:13:01 +00:00
Thomas Haller
bdd6b753ca main: document notify function gets called during g_source_destroy()
This seems non-obvious to me. Document it.

It also seems important to know, because it means that the data pointer
might already be destroyed, before the source is unreferenced for good.
For example, if the data pointer keeps a reference to the GSource,
and it might seem sensible to call:

    g_source_destroy(data->source);
    g_source_unref(data->source); /* <<< data is already destroyed? */

This leads to a crash, if the source was attached to a context.
2021-05-10 13:16:05 +02:00
Thomas Haller
b0157af9a6 gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()
Since commit ab285899a6 ('gdbusconnection: Document main context
iteration for unsubscript'), we document when the user is guaranteed
that all resources are gone after g_dbus_connection_signal_unsubscribe().
This is not merely an implementation detail, it's something that the
user needs to be able to rely on. It is good that this is documented.

However, libnm does something different ([1]). It registers to several D-Bus
signals without providing a GDestroyNotify. After unsubscription, it schedules
another idle action with lower priority and uses that to know when
cleanup is complete. I think this is a useful alternative and should
also be guaranteed and documented to work.

Also note that this isn't just some implementation detail that currently
happens to work. GDBusConnection tightly integrates with GMainContext and it
works by scheduling idle sources with G_PRIORITY_DEFAULT priority. It needs to
schedule all events with this same priority, otherwise the ordering is not
preserved. At this point, with GDBusConnection working this way, this is no longer
something that can reasonably be any different. It's how GDBusConnection fundamentally
works, and a user must be able to rely on that. As such, this new promise isn't
something that we would want to break in the future.

Thus document it.

[1] a55c10c6cb/src/libnm-client-impl/nm-client.c (L7918)
2021-05-10 13:16:05 +02:00
Nishal Kulkarni
827b4ec855 grefcount: Optimise g_atomic_ref_count_inc
Currently, `g_atomic_ref_count_inc ()` does three operations.
We try to get this down to one operation.

Fixed by replacing `g_atomic_int_inc ()` with `g_atomic_int_add ()`
which increments by 1 and returns old value

Note: changes current behaviour, checks are now done after increment.

Closes: #1583
2021-05-10 15:45:00 +05:30
Philip Withnall
66fe1da95a Merge branch 'serializ' into 'master'
docs: Standardize spelling of serializ*

See merge request GNOME/glib!2090

Helps: #2399
2021-05-10 09:50:07 +00:00
Руслан Ижбулатов
d270d5b615 Use SHGetKnownFolderPath() on Windows
SHGetSpecialFolderLocation() can cause 200ms delays when getting some
folder locations.

Also, use SHGetKnownFolderPath() normally, without loading it at runtime,
since GLib is Windows 7-or-later now.

Fixes #2397
2021-05-07 12:33:51 +00:00
Geyslan G. Bem
8cc03f8cd8 docs: Standardize spelling of serializ*
Changes serialis* to serializ* as proposed in #2399.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-07 08:51:22 -03:00
Sebastian Dröge
0c259e9fbb Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2088
2021-05-07 06:49:26 +00:00
Emmanuel Fleury
9656e606d2 Fix cast to smaller integer type warning in glib/gscanner.c
glib/gscanner.c:1681:13: warning: cast to smaller integer type 'GTokenType' from 'gpointer' (aka 'void *')
        *token_p = (GTokenType) value_p->v_symbol;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-06 23:07:04 +02:00
Emmanuel Fleury
83d46f6a0a Fix missing field initializer in glib/deprecated/gthread.h
glib/deprecated/gthread-deprecated.c:473:42: warning: missing field 'unused' initializer
  static const GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
                                         ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
glib/deprecated/gthread-deprecated.c:659:45: warning: missing field 'unused' initializer
  static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
                                            ^
glib/deprecated/gthread.h:170:35: note: expanded from macro 'G_STATIC_REC_MUTEX_INIT'
                                  ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
glib/deprecated/gthread-deprecated.c:959:42: warning: missing field 'unused' initializer
  static const GStaticRWLock init_lock = G_STATIC_RW_LOCK_INIT;
                                         ^
glib/deprecated/gthread.h:206:33: note: expanded from macro 'G_STATIC_RW_LOCK_INIT'
                                ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
2021-05-06 22:54:53 +02:00