Commit Graph

21006 Commits

Author SHA1 Message Date
Patrick Griffis
01acb8907f tests: Don't block mainloop for delays in gnetworkaddress tests 2019-10-10 14:32:18 +01:00
Matthias Clasen
1fb3628fb3 hash: Remove an assertion from the hot path
This assert is using atomics and was showing up
in some cache-heavy GTK profiles. Remove it.
2019-10-10 14:24:42 +01:00
Philip Withnall
b50447b0ab Merge branch 'issue1906' into 'master'
gutils test: Don't assume that every Unix OS implements os-release(5)

Closes #1906

See merge request GNOME/glib!1159
2019-10-10 13:18:44 +00:00
Philip Withnall
0869cdedcf Merge branch '1858-tutorial-deprecated-gobject-api' into 'master'
Fix handling of private object members in GObject property tutorial

Closes #1858

See merge request GNOME/glib!1069
2019-10-10 13:15:39 +00:00
Daniel Mustieles
150b946974 Updated Spanish translation 2019-10-10 13:55:48 +02:00
Philip Withnall
d770e00d9c Merge branch 'wip/g-warning-once' into 'master'
gmessages: Add g_warning_once()

See merge request GNOME/glib!1028
2019-10-09 15:09:53 +00:00
Jonas Ådahl
15e3b6f136 gmessages: Add g_warning_once()
In many places the pattern

    static gboolean warned_once = FALSE;
    if (!warned_once)
      {
        g_warning ("This and that");
        warned_once = TRUE;
      }

is used to not spam the same warning message over and over again. Add a
helper in glib for this, allowing the above statement to be changed to

    g_warning_once ("This and that");
2019-10-09 16:39:31 +02:00
Simon McVittie
f9a1970a0f gutils test: Don't assume that every Unix OS implements os-release(5)
os-release(5) is widely implemented on Linux, but not necessarily
ubiquitous: unusual or minimal Linux distributions might not have it.
It could in principle be implemented by any other Unix OS, but in
practice this has not yet happened.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1906
Fixes: 349318e8 "gutils: Add g_get_os_info()"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-09 14:11:08 +01:00
Simon McVittie
35e26151a8 Merge branch 'android-warning-fixes' into 'master'
Fix various compiler warnings on Android

See merge request GNOME/glib!1157
2019-10-09 12:33:00 +00:00
Philip Withnall
8492df9f34 gdbusaddress: Validate the noncefile attribute of nonce-tcp addresses
Doing this mostly to fix a compiler warning about tautological
assignments on Android.

See the D-Bus specification:
https://dbus.freedesktop.org/doc/dbus-specification.html#transports-nonce-tcp-sockets

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-08 13:53:01 +01:00
Philip Withnall
e99003841a gdbusaddress: Collapse two translatable strings into one
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-08 13:51:57 +01:00
Philip Withnall
3c4ff30c0f gunicollate: Remove tautological comparison
As an unsigned integer, this variable is always greater than or equal to
zero. Fixes a compiler warning on Android.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-08 13:50:13 +01:00
Philip Withnall
e257e17d2e inotify: Fix some enum comparisons to integers
`-1` isn’t a valid member of the enum, so cast to `int` first. This
fixes a compiler warning on Android.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-08 13:49:40 +01:00
Ting-Wei Lan
1bda4db213 Update Chinese (Taiwan) translation 2019-10-08 10:45:43 +00:00
Philip Withnall
0d94ee3bb4 Merge branch 'master' into 'master'
Erase GI annotation: skip g_cancellable_source_new

Closes #1877

See merge request GNOME/glib!1048
2019-10-08 10:33:40 +00:00
Philip Withnall
45c91d7ed6 Merge branch 'g-os-info' into 'master'
gutils: Add g_get_os_info()

See merge request GNOME/glib!1063
2019-10-08 10:30:24 +00:00
Philip Withnall
ab613ae805 Merge branch '1726-gdbus-codegen-h' into 'master'
Resolve "Warn when method/signal uses type 'h' but lacks GDBus.C.UnixFD annotation"

Closes #1726

See merge request GNOME/glib!1079
2019-10-08 10:26:45 +00:00
Philip Withnall
b229eed0e4 Merge branch 'str-printf-abort-oom' into 'master'
Ensure that g_vasprintf will always abort on OOM and some docs fixes

Closes #1622

See merge request GNOME/glib!1145
2019-10-07 17:21:32 +00:00
Daniel P. Berrangé
109be1e90d glib: add parameter annotations for g_vasprintf and callers
Document that g_vasprintf and g_strdup_printf are guaranteed to return a
non-NULL string, unless the format string contains the locale sensitive
conversions %lc or %ls.

Further annotate that the output parameter for g_vasprintf and the
format string for all functions must be non-NULL.

Fixes #1622

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 17:29:34 +01:00
Daniel P. Berrangé
14035010dd glib: ensure consistent abort-on-OOM with g_vasprintf & its callers
The g_vasprintf method is called by g_strdup_vprintf, g_strdup_printf,
g_string_append_vprintf and more. It has three different implementations
depending on what the build target platform supports:

  1. The gnulib impl appears to use the system malloc, but a
     '#define malloc g_malloc' causes it to use GLib's wrapper
     and thus abort on OOM. This mostly gets used on Windows
     platforms or UNIX platforms with broken printf formatting.

  2. The main impl mostly used on modern Linux/UNIX calls the
     system vasprintf which uses the system malloc and does not
     abort on OOM.

  3. The final impl used on remaining platforms calls system
     vsprintf on a buffer allocated by g_new, and thus always
     aborts on OOM.

Of note is that impl 2 (using vasprintf) historically could abort on
OOM, if the application had installed a non-system malloc impl with
GLib. This was because the code would g_strndup the result from
vasprintf() in that scenario. This was removed in:

  commit a366053253
  Author: Dan Winship <danw@gnome.org>
  Date:   Fri Aug 7 09:46:49 2015 -0400

    glib: remove deprecated g_mem_is_system_malloc() check in gprintf.c

Having inconsistent OOM behaviour for the three impls is undesirable and
aborting on OOM is normal pratice for GLib APIs. Thus we must thus ensure
this happens in all impls of g_vasprintf.

Fixes #1622

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 17:29:29 +01:00
Philip Withnall
d9b30d47a6 gmain: Remove some redundant casts
These were introducing strict aliasing warnings. Remove them (in line
with other uses of `g_once_init_leave()`).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 16:29:26 +01:00
Philip Withnall
3251cce524 gatomic: Fix strict aliasing problems with g_atomic_pointer_{get,set}()
Casting pointer types around is a bit fiddly when you also end up
dereferencing them. Take advantage of the fact that the
`__atomic_load()` and `__atomic_store()` built-ins are polymorphic, and
use `__typeof__()` to ensure that the atomic pointer macros use the
caller-provided types internally, and hence any type mismatches are
entirely the caller’s fault rather than ours.

This also means that the `__atomic_{load,store}()` built-ins have the
right alignment and width data from the caller-provided types, in case
that’s needed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 16:23:02 +01:00
Philip Withnall
81f8d02e4d glib: Various fixes to the return type of atomic functions
Various places that used atomic functions were using the wrong return
type. Fix that. This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 16:21:24 +01:00
Philip Withnall
4e12e7ed0d Merge branch 'th/main-context-default-no-mutex' into 'master'
gmain: use atomic operation instead of GMutex to access g_main_context_default()

See merge request GNOME/glib!1135
2019-10-07 13:22:30 +00:00
Thomas Haller
39dd2be538 gmain: use atomic operation instead of GMutex to access g_main_context_default()
I think it is wasteful to use a mutex every time the default main context
is accessed. Especially, as the default main context is used all the
time.
2019-10-07 13:22:30 +00:00
Philip Withnall
038ec3de31 Merge branch 'add_array_steal_function' into 'master'
Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()

Closes #285

See merge request GNOME/glib!1019
2019-10-07 13:07:56 +00:00
Paolo Bonzini
7bada8394d Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()
Closes issue #285
2019-10-07 14:38:24 +02:00
Philip Withnall
c88f106471 Merge branch 'wip/oholy/gio-completion' into 'master'
Several gio-tool bash completion fixes and improvements

See merge request GNOME/glib!1153
2019-10-07 09:23:41 +00:00
Philip Withnall
a350fa50a5 Merge branch 'winhttp-handle-null-prgname' into 'master'
gwinhttpvfs: Handle g_get_prgname() returning NULL

See merge request GNOME/glib!1152
2019-10-07 09:04:06 +00:00
Philip Withnall
419b7d00d8 Merge branch 'glib-g_ptr_array_sort_api_doc_example' 2019-10-07 09:53:01 +01:00
Lee Bigelow
52c130f888 Add full examples to g_ptr_array_sort() and g_ptr_array_sort_with_data()
With changes by Emmanuel Fleury and Philip Withnall.

Closes issue #9
2019-10-07 09:50:51 +01:00
Philip Withnall
acf55ad584 Merge branch 'solaris-build-fixes' into 'master'
Solaris build fixes

See merge request GNOME/glib!1146
2019-10-07 08:44:39 +00:00
Ondrej Holy
b3bf1e263e gio: Always include mounts in the results
Mounts are currently completed only if the prefix looks like scheme,
however, this doesn't work well if the mounts have also path component.
Let's always include them to fix this issue. The mounts are cached by the
volume monitors, so it should not significantly affect the performance.
2019-10-07 09:21:19 +02:00
Ondrej Holy
8bc52105ef gio: Complete also activation roots of volumes
Currently, "gio mount google-drive<tab>" isn't completed even though
that volume exists for google-drive://oholy@redhat.com/. Let's use
"gio mount -li" output to complete also activation roots of volumes.
2019-10-07 09:21:19 +02:00
Ondrej Holy
3a1492ec4f gio: Fix completion of URIs without hostname part
Currently, "gio list file:///h<tab>" doesn't complete "file:///home"
because the result of "dirname file:///h" is not "file:///" but "file:/",
which breaks the consequent logic. Let's subtract basename from the
path in order to workaround this issue.
2019-10-07 09:21:09 +02:00
Christoph Reiter
bf2a10211b gwinhttpvfs: Handle g_get_prgname() returning NULL
When prgname wasn't set NULL would be passed to g_utf8_to_utf16()
resulting in "g_utf8_to_utf16: assertion 'str != NULL' failed"
2019-10-06 20:05:44 +02:00
Simon McVittie
dd27d2beeb Merge branch 'patch-1' into 'master'
gio/gfile: fix parameter reference for value_p

See merge request GNOME/glib!1149
2019-10-06 13:18:44 +00:00
Simon McVittie
cb97f0e114 Merge branch 'dlech-master-patch-99473' into 'master'
gio/gfileinfo: fix parameter references

See merge request GNOME/glib!1148
2019-10-06 13:17:59 +00:00
Simon McVittie
5ac73a0972 Merge branch 'patch-2' into 'master'
gio/gfile: fix parameter references to @contents

See merge request GNOME/glib!1150
2019-10-06 13:17:17 +00:00
Simon McVittie
c46c31de91 Merge branch 'patch-3' into 'master'
gio/gfile: fix typo in doc comment

See merge request GNOME/glib!1151
2019-10-06 13:16:23 +00:00
David Lechner
4723bf5720 gio/gfile: fix typo in doc comment
This fixes a typo in g_file_has_prefix() do comments.
2019-10-06 02:01:48 +00:00
David Lechner
f71eca16d5 gio/gfile: fix parameter references to @contents
Fix a number of occurrences where the parameter reference was missing the trailing 's'
2019-10-06 01:55:40 +00:00
David Lechner
5120f92c33 gio/gfile: fix parameter reference for value_p
This fixes a parameter reference to @value_p in g_file_set_attribute()
2019-10-06 01:48:15 +00:00
David Lechner
5dee5263e8 gio/gfileinfo: fix parameter references
This fixes a couple of parameter references for @info in the doc comments.
2019-10-05 22:36:19 +00:00
Sebastian Dröge
25ed7d45d9 Merge branch 'gmodule-typo' into 'master'
gmodule: fix typo in doc comment

See merge request GNOME/glib!1147
2019-10-05 06:56:01 +00:00
David Lechner
5a57bdbc45 gmodule: fix typo in doc comment
s/opended/opened/
2019-10-05 01:45:22 +00:00
Alan Coopersmith
2b34f52b01 build: no --export-dynamic ldflags for Solaris
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-10-04 13:23:25 -07:00
Alan Coopersmith
e5e1490990 gunixmounts: Handle Solaris name of mnt_mntopts in place of mnt_opts
Fixes build failure:
../gio/gunixmounts.c: In function ‘_g_get_unix_mounts’:
../gio/gunixmounts.c:742:53: error: ‘struct mnttab’ has no member named ‘mnt_opts’; did you mean ‘mnt_mntopts’?
  742 |                                              mntent.mnt_opts,
      |                                                     ^~~~~~~~
      |                                                     mnt_mntopts

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-10-04 12:55:17 -07:00
Emmanuele Bassi
c08e7b9364 Merge branch 'switch_to_gnu99' into 'master'
Switching from C gnu89 to C gnu99 standard

See merge request GNOME/glib!1035
2019-10-04 14:51:10 +00:00
Philip Withnall
66da7beb65 2.63.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-04 14:55:44 +01:00