Commit Graph

19369 Commits

Author SHA1 Message Date
Hans Petter Jansson
035975da09 Merge branch 'master' into 'master'
ghash: Fix out-of-range use of signed integer

Closes #1570

See merge request GNOME/glib!399
2018-10-12 20:20:59 +00:00
Hans Petter Jansson
d3074a748f ghash: Fix out-of-range use of signed integer
We were mistakenly shifting a signed int literal by up to 31 places.
Specify unsigned int instead.

Closes #1570
2018-10-12 13:09:39 +02:00
Philip Withnall
603fb5958d Merge branch 'glib' into 'master'
Add useful links to fuzzing README

See merge request GNOME/glib!398
2018-10-11 21:56:15 +00:00
pdknsk
8b151f5055 Add useful links to fuzzing README 2018-10-11 22:11:00 +02:00
Emmanuele Bassi
3b5e5b8f9e Merge branch 'm4-fixes' into 'master'
m4: Fix AM_PATH_GLIB_2_0 macro

See merge request GNOME/glib!396
2018-10-11 13:04:10 +00:00
Simon McVittie
54cbc9bccf m4macros: Fix detection of glib-2.0 alone
We unconditionally appended ">= $min_glib_version" to the modules to
look for, even though we had already included
"glib-2.0 >= $min_glib_version" in our list. When requesting additional
modules, this was fine, for example

    AM_PATH_GLIB_2_0([2.58], [:], [:], [gobject gio])

ended up asking pkg-config for

    glib-2.0 >= 2.58 gobject-2.0 gio-2.0 >= 2.58

which is redundant (since they all share a version number) but
otherwise OK.

However,

    AM_PATH_GLIB_2_0([2.58], [:], [:], [])

ended up asking pkg-config for

    glib-2.0 >= 2.58 >= 2.58

which is not OK; the second ">=" was parsed as a bizarrely-named package
to check for, and obviously few people have ">=.pc" installed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: 4bb16f48 "m4macros: Allow information from pkg-config to be overridden"
2018-10-11 12:50:21 +01:00
Philip Withnall
7ec354d1d6 Merge branch 'glib' into 'master'
Integrate oss-fuzz targets

Closes #1471

See merge request GNOME/glib!371
2018-10-11 00:02:03 +00:00
pdknsk
a2c09f57f6 Integrate oss-fuzz targets 2018-10-11 00:02:03 +00:00
Philip Withnall
6c8b9f31b1 Merge branch '179-object-unref-warning' into 'master'
gobject: Convert a debug check from an assertion to a g_critical()

Closes #179

See merge request GNOME/glib!389
2018-10-10 23:36:20 +00:00
Philip Withnall
efda2be302 Merge branch 'ghash-hpj-2018' into 'master'
GHashTable improvements

See merge request GNOME/glib!208
2018-10-10 23:01:51 +00:00
Philip Withnall
0b45ddc556 Merge branch 'poolname' into 'master'
gthreadpool: Include prgname in thread name

See merge request GNOME/glib!374
2018-10-10 22:45:08 +00:00
Philip Withnall
b9a8c03915 gobject: Convert a debug check from an assertion to a g_critical()
An assertion is harder to skip over, and using a g_critical() can give
us a more informative error message.

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

https://gitlab.gnome.org/GNOME/glib/issues/179
2018-10-11 11:40:12 +13:00
Vincent Whitchurch
c50bdf07e8 gthreadpool: Include prgname in thread name
All pool threads are named "pool" and this a bit annoying when looking
at system-wide traces or statistics for a system where several
applications use thread pools.  Include the prgname in the thread names
to get a better default name.  The total length including the "pool-"
prefix is limited to 16 bytes in order for it to work on all systems.

Change-Id: I473a9f534c4630f3e81da72ff96d8f593c60efac
2018-10-10 10:57:39 +02:00
Philip Withnall
d3928abe45 Merge branch 'wip/lantw/enable-freebsd-ci-only-in-gnome' into 'master'
ci: Enable FreeBSD CI in the official repository

See merge request GNOME/glib!387
2018-10-09 21:08:54 +00:00
Ting-Wei Lan
fb8d95467d ci: Enable FreeBSD CI in the official repository
Since we are unable to promote our FreeBSD runner to a shared runner,
we can only enable it in GNOME group. This should avoid problems when
submitting merge requests from forks.
2018-10-09 23:06:06 +08:00
Emmanuele Bassi
fb65dda651 Merge branch '734-proxy-construction-docs' into 'master'
gdbusproxy: Document blocking guarantees of constructors

Closes #734

See merge request GNOME/glib!380
2018-10-09 10:20:33 +00:00
Mohammed Sadiq
0e7ebf794f gmacros: Fix G_[UN]LIKELY to not mask -Wparentheses
A double paren forces the compiler to assume that the
statement is right.  That may not be the case.

This is essentially reverting b44fba25fb.
See https://bugzilla.gnome.org/show_bug.cgi?id=760215.

It's more morth to allow find common mistakes (= instead of ==
in conditionals) than masking them to make some rarely used
code work.
2018-10-09 06:44:14 +05:30
Philip Withnall
3b10fc035d Merge branch 'm4macros' into 'master'
m4macros: Allow information from pkg-config to be overridden

See merge request GNOME/glib!375
2018-10-08 22:43:46 +00:00
Philip Withnall
2eaeefdf5d gdbusproxy: Document blocking guarantees of constructors
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/734
2018-10-09 09:15:43 +13:00
Kjartan Maraas
fce9444e67 Updated Norwegian bokmål translation. 2018-10-07 11:10:33 +02:00
Philip Withnall
22d75a0889 Merge branch 'lcov-branch-coverage-tests' into 'master'
Ignore g_return_*if_fail() branches in lcov coverage report

See merge request GNOME/glib!379
2018-10-06 13:02:45 +00:00
Philip Withnall
8efe28c570 ci: Add lcov configuration to ignore g_return_*if_fail()/g_assert*()
While we can’t add markers to the macro implementations to cause lcov to
ignore them automatically, we can change our lcov configuration to
ignore all calls to them.

See https://github.com/linux-test-project/lcov/issues/44.

This causes all the un-takeable branches and un-reachable assertions to
be ignored by our code coverage, which bumps our statistics:
 • Lines: 74.9% → 74.8%
 • Functions: 82.3% → 82.3%
 • Branches: 53.3% → 64.2%

The rationale is that nobody should be testing programmer error
handling, as g_return_*if_fail() are used to guard against — so it’s not
reasonable to count missed branches like that in code coverage
statistics.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-06 00:19:20 +01:00
Simon McVittie
4bb16f4845 m4macros: Allow information from pkg-config to be overridden
By using PKG_CHECK_VAR, we declare $GLIB_COMPILE_SCHEMAS,
$GLIB_GENMARSHAL, $GOBJECT_QUERY, $GLIB_MKENUMS and
$GLIB_COMPILE_RESOURCES as Autoconf "precious variables" with AC_ARG_VAR,
similar to $PKG_CONFIG and $CC, so that they can be put on a configure
command line:

    ./configure GLIB_COMPILE_RESOURCES=my-glib-compile-resources

If they are set to a non-empty value, PKG_CHECK_VAR will use that
instead of auto-detecting from pkg-config, so that builders can
override them, for example when cross-compiling.

Similarly, use the standard PKG_CHECK_MODULES macro to get GLib's CFLAGS
and LIBS.

It's possible that most of the rest of each macro can also disappear,
but for the moment I've given them the benefit of the doubt.

This does result in printing "checking for GLIB" twice (once for
PKG_CHECK_MODULES and once for GLib's custom checks), but if you're
using Autotools, you probably don't have a strong objection to overly
verbose output.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-04 20:47:29 +01:00
Emmanuele Bassi
4d215e006e tests: Update month name check for Lithuanian locale
Update the abbreviated month name in the test to match the GNU libc
translation, coming from CLDR.

Fixes #1562
2018-10-04 14:43:53 +02:00
Christoph Reiter
180e59539c build: work around meson issue with too long filenames on Windows. Fixes #1556
When using glib as a meson subproject on Windows the build currently fails
due to too long paths during the build process. See
https://github.com/mesonbuild/meson/issues/4226 for the upstream bug.

To work around the issue shorten the filenames of the generated gdbus files.
2018-10-04 10:45:45 +02:00
Hans Petter Jansson
0600dd3220 tests: Fix bad node ordering assumption
The tests were making assumptions about the order of the returned D-Bus
introspection nodes. However, these are semantically unordered and
changes to e.g. GHashTable would break the tests.

Fix this by applying a sort prior to validation.
2018-10-03 22:14:38 +02:00
Hans Petter Jansson
eed0f182fd tests: Remove assertion that unused buckets should have NULL key/value
We still clear the key/value on removal, but since we're growing the
arrays with realloc() now, we can't guarantee that incoming memory is
cleared. There's no reason it should be either, since we check the
hashes array (which is always in a defined state) before accessing the
other arrays.
2018-10-03 22:14:38 +02:00
Hans Petter Jansson
9986395638 ghash: Use realloc in place of alloc for key/value
Minor simplification resulting in the removal of redundant alloc wrappers.
2018-10-03 22:14:38 +02:00
Hans Petter Jansson
194eef5f17 ghash: Be less eager to opportunistically grow the table on cleanup
When g_hash_table_resize() gets called, we clear out tombstones and grow
the table at the same time if needed. However, the threshold was set too
low, so we'd grow if the load was greater than .5 after subtracting
tombstones. Increase this threshold to ~.75.
2018-10-03 22:14:38 +02:00
Hans Petter Jansson
7eaf018b29 ghash: Significantly reduce peak memory use
When resizing, we were keeping both the old and new hash, key and value
arrays around while we reinserted entries, resulting in a peak memory
overhead of 50%. Using a temporary bookkeeping array with one bit per
entry we can now grow and shrink the main arrays using realloc() and an
eviction scheme, reducing the overhead to .625% (assuming 64-bit keys and
values). Tests show the CPU overhead is negligible.
2018-10-03 22:14:32 +02:00
Hans Petter Jansson
dc983d74cc ghash: Use less memory when storing ints on 64-bit platforms
If int is smaller than void * on our arch, we start out with
int-sized keys and values and resize to pointer-sized entries as
needed. This saves a good amount of memory when the HT is being
used with e.g. GUINT_TO_POINTER().
2018-10-03 22:11:07 +02:00
Philip Withnall
96c653265f gmessages: Reformat g_return_*if_fail() macros to fix whitespace
I’m fed up of trying to read these and having my head done in by mixed
tabs and spaces.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-03 14:45:12 +01:00
Philip Withnall
da8f1c6ac3 Revert "ci: Enable FreeBSD CI"
This partially reverts commit bfc362cb68.

The FreeBSD CI runner still seems to be a bit flakey, and appears to be
offline entirely at the moment.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-10-03 13:12:22 +01:00
Philip Withnall
7b5756577f Merge branch 'fix-leaking-g_get_language_names_with_category' into 'master'
gcharset: fix leaking g_get_language_names_with_category

See merge request GNOME/glib!338
2018-10-02 10:42:14 +00:00
Philip Withnall
5002d87dec Merge branch '1525-task-result' into 'master'
gtask: Check an error hasn’t been returned when calling g_task_return*()

Closes #1525

See merge request GNOME/glib!368
2018-10-02 10:07:49 +00:00
Philip Withnall
290bb0dd1b gtask: Compress GTask struct using a bitfield
There are a lot of gbooleans in the private GTask struct, which seems a
bit wasteful. Use a bitfield to compress the struct a bit.

This reduces the size of the struct from 216 bytes to 168 bytes on my
64-bit machine.

One of the fields needs to remain separate, since it’s used from a
TRACE() macro which calls typeof() on it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-02 09:59:13 +01:00
Philip Withnall
f0cecba199 tests: Add return ordering tests for GTask
These are based on an example test program provided by Will Thompson in
issue #1525.

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

https://gitlab.gnome.org/GNOME/glib/issues/1525
2018-10-02 09:59:13 +01:00
Philip Withnall
32e049b761 Merge branch 'win32-gstat-for-ucrt' into 'master'
W32: gstat fixes for ucrt

Closes #1452

See merge request GNOME/glib!257
2018-10-02 08:55:45 +00:00
Philip Withnall
bea3770935 gtask: Check an error hasn’t been returned when calling g_task_return*()
These functions already check to see if a successful result has already
been returned; expand them to also check to see if an error has been
returned.

We can’t just check GTask.result_set, as that’s actually an indicator
for whether the GTask.result member is filled — when
g_task_propagate_*() is called, it’s cleared again. We need a new state
bit.

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

https://gitlab.gnome.org/GNOME/glib/issues/1525
2018-10-01 21:45:48 +01:00
Philip Withnall
03232bd6a6 tests: Fix location of an unref in the GTask tests
This method drops the last reference *it* owns to the GTask, but then
continues to call methods on the GTask. This wasn’t resulting in
failures because a ref in another thread kept the GTask alive, but
that’s quite dodgy.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-01 21:45:48 +01:00
Philip Withnall
846a61457a Merge branch 'wjt/g_desktop_app_info_get_string_list' into 'master'
Add g_desktop_app_info_get_string_list(); fix g_key_file_free()

See merge request GNOME/glib!339
2018-10-01 19:21:05 +00:00
Will Thompson
5ca9eca632 gdesktopappinfo: add get_string_list() function
The X-Flatpak-RenamedFrom key is used in .desktop files to identify past
names for the desktop file. It is defined to be a list of strings.
However, there was previously no correct way to retrieve a list of
strings from the GKeyFile wrapped by GDesktopAppInfo, short of
re-parsing the file with GKeyFile.

Note that doing something like:

    g_strsplit (g_desktop_app_info_get_string (...), ";", -1)

is not correct: the raw value "a\;b;" represents the one-element list
["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so
g_desktop_app_info_get_string() returns NULL in this case. (Of course, a
.desktop file with a semicolon in its name is a pathological case.)

Add g_desktop_app_info_get_string_list(), a trivial wrapper around
g_key_file_get_string_list(), similar to g_desktop_app_info_get_string()
and co.

The change from g_key_file_free() to g_key_file_unref() in the test is
needed because g_key_file_free() clears the contents of the keyfile.
This is fine for all the fields which are eagerly loaded and copied into
GDesktopAppInfo, but not when we want to access arbitrary stuff from the
keyfile.
2018-10-01 20:03:55 +01:00
Philip Withnall
e1f4ff6c25 Merge branch 'non-POSIX-spawn' into 'master'
Fix build failure on systems without POSIX spawn

See merge request GNOME/glib!345
2018-09-29 09:18:15 +00:00
Philip Withnall
4c05f339a9 Merge branch 'wip/lantw/enable-freebsd-ci' into 'master'
ci: Enable FreeBSD CI

See merge request GNOME/glib!364
2018-09-29 09:16:32 +00:00
Ryan Schmidt
a187c89002 Fix build failure on systems without spawn.h 2018-09-28 23:50:40 -05:00
Ting-Wei Lan
bfc362cb68 ci: Enable FreeBSD CI 2018-09-29 01:05:39 +08:00
Xavier Claessens
6e0a03ee07 Merge branch '1536-link-whole' into 'master'
Meson: Fix static linking of convenience libraries

Closes #1536

See merge request GNOME/glib!357
2018-09-28 14:54:40 +00:00
Simon McVittie
62af03bda8 Meson: Extract objects from convenience libraries to link them
This avoids the convenience library being treated as though it was
an installed static library (objects not included in the dependent
static library, and convenience library being listed in the pkg-config
metadata), both of which would make static linking impossible.
This is a workaround for meson not having
https://github.com/mesonbuild/meson/pull/3939 merged yet.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1536
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-28 15:15:48 +01:00
Philip Withnall
0e117cffa5 Merge branch 'ci-meson-0-48' into 'master'
Ci meson 0 48

See merge request GNOME/glib!347
2018-09-28 13:47:40 +00:00
Philip Withnall
c824ffd377 Merge branch 'wip/rishi/docs-garray' into 'master'
Documentation tweaks for g_array_free

See merge request GNOME/glib!348
2018-09-28 13:06:04 +00:00