Commit Graph

17646 Commits

Author SHA1 Message Date
Emmanuele Bassi
bc277bfcef docs: Fix typo in the GObject tutorial
The description of the instance construction does not match the example.
2017-11-25 10:24:07 +00:00
Philip Withnall
b97e5cb21b glib-tap: Add missing mkdir for .test generation rule
We can’t guarantee that the builddir we’re generating in actually exists
— if doing a clean build with builddir ≠ srcdir, and there are no other
rules which generate build products in builddir, the .test generation
rule can fail. This happens for flatpak-builder.git for me.

Try to avoid that by explicitly creating the builddir.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790785
2017-11-24 13:10:11 +00:00
Nirbheek Chauhan
87122cae38 meson: Fix gnulib compilation on MSVC
glibinc is needed for including glibconfig.h, this was not noticed
during testing probably because a system-installed header got picked
up instead.
2017-11-24 12:41:53 +05:30
Nirbheek Chauhan
7a9d92702e meson: Create gio-unix and gio-win32 internal deps
These are useful when using glib as a subproject and you want to use
gio-unix-2.0 or gio-win32-2.0.
2017-11-24 12:40:43 +05:30
Nirbheek Chauhan
bd22bb9898 meson: Use files() for gio sources and headers
This allows them to be fetched with subproject().get_variable(). Needed
for generating Gio-2.0.gir in the gobject-introspection meson port.
2017-11-23 23:03:57 +05:30
Philip Withnall
1969af3e8c build: Use AM_DISTCHECK_CONFIGURE_FLAGS rather than unprefixed version
Since automake 1.11.2, it’s recommended to use the prefixed version and
leave the unprefixed version for users to override. Since we depend on
automake 1.13.3, we should be doing this.

Based on a patch by Sam Spilsbury <smspillaz@gmail.com>.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-23 16:37:00 +00:00
Nirbheek Chauhan
2e5bb92de6 meson: Use files() for headers and sources
This allows them to be fetched via subproject().get_variable(). Needed
for the gobject-introspection meson port.
2017-11-22 14:11:11 +05:30
Nirbheek Chauhan
c603ba301d meson: Add 'charsetalias-dir' option mirroring the autotools one
This fixes the build again.
2017-11-22 04:43:05 +05:30
Philip Withnall
4e5c6616f0 tests: Add tests for GArray constructors
Noticed these were missing when handling bug #733648. Add a few missing
tests to improve coverage.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-21 12:43:17 +00:00
Philip Withnall
0dc68e5d46 tests: Use g_test_skip() instead of a message in GDateTime tests
There are some GDateTime tests which need to be skipped if changing the
locale fails. Use g_test_skip() to do that, rather than just a
human-readable message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-21 12:42:42 +00:00
Alan Coopersmith
ca32be3bf2 Fix -z nodelete configure check to work on Solaris
Passing -z nodelete without the shared library flags on Solaris results in
ld: fatal: option '-z nodelete' is incompatible with building a dynamic executable
which causes the configure test to falsely report its not supported.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776195
2017-11-21 12:14:27 +00:00
Daniel Macks
6bcc8b4034 Add configuration option for charset.alias directory
Specifically controlling the location of this file, rather than simply
using $libdir, allows one to avoid conflicting with the same default
location as the gnulib localcharset module uses.

https://bugzilla.gnome.org/show_bug.cgi?id=346816
2017-11-20 11:27:21 +00:00
Daniel Macks
deeacce18a Do not load systemwide giomodules during self-test
$libdir/gio/modules/*.so on the live build machine are supplied by
third parties, so we should not look there while testing ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-11-20 10:23:23 +00:00
Daniel Macks
0b10c41a04 Git should ignore generated config.py file
gio/gdbus-2.0/codegen/config.py is generated by ./configure from
gio/gdbus-2.0/codegen/config.py.in

https://bugzilla.gnome.org/show_bug.cgi?id=790588
2017-11-20 10:17:01 +00:00
Philip Withnall
f2c093f657 build: Drop --enable-rebuilds configure option
It is outdated and no longer effectively used. It was originally in
place to prevent rebuilding generated files (from a tarball) if the
right build tools (awk, Perl, indent) were not available. However, we no
longer use indent, we have hard-required awk for a while, and the only
places the @REBUILD@ substitution was still used were for
glib-genmarshal, which has recently been rewritten in Python (so no
longer depends on whether Perl is available).

Drop the whole lot.

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

https://bugzilla.gnome.org/show_bug.cgi?id=694723
2017-11-17 15:11:47 +00:00
Philip Withnall
9ab0073321 glocalfileinfo: Fix a leak on an error handling path
Spotted by Clang static analysis, thanks to Leslie Zhai.

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

https://bugzilla.gnome.org/show_bug.cgi?id=777075
2017-11-17 14:39:55 +00:00
Emanuele Aina
e73831d808 tests: Re-wire the testgobject test program to the build system
After the build system rework in commit f9eb9e testgobject fell through
the cracks and was not built since then.

Re-enable it, even if it is currently failing due to commit 31fde56.

(Tweaked by Philip Withnall to add meson.build support.)

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:27:10 +00:00
Emanuele Aina
edcabe1a4e tests: Don't assume that private data follows the instance data
Commit 31fde56 changed the way the private data is laid out in memory by
putting it *before* the instance data to keep the offsets fixed
regardless of the number of many subclasses.

This means that the invariant testgobject was verifying is no longer
true and the failing tests can be safely dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:26:23 +00:00
Philip Withnall
63c07f9b63 codegen: Change (allow-none) annotations to (nullable)
(nullable) has been around for a while now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-17 11:42:48 +00:00
Daiki Ueno
c71098ddab tests/gmenumodel: Add test cases using peer-to-peer D-Bus connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
f29065c315 GMenuExporter: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
d37af2bd04 GDBusActionGroup: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
e8a09b3f85 GDBusMenuModel: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Luca Bruno
3b89702bcf glib/tests/mappedfile.c: Use temp dir instead of user runtime dir
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724412
2017-11-16 11:17:19 +00:00
Christophe Fergeau
8d5c30cf90 Fix "on on" typo in tap-driver.sh comment
It should be "and/or on systems" rather than "and/on on systems"

https://bugzilla.gnome.org/show_bug.cgi?id=724794
2017-11-16 11:16:28 +00:00
Dan Winship
42d3ed0013 glib: document restrictions on various foreach() functions
Some foreach() functions allow you to modify the object they are
iterating, and others don't, but the docs were not generally clear
about this.

https://bugzilla.gnome.org/show_bug.cgi?id=724383
2017-11-16 11:12:32 +00:00
David Schleef
3cfac71d09 gdatetime: fix floating-point conversion
Conversion from floating point to integer requires special care.

https://bugzilla.gnome.org/show_bug.cgi?id=697715
2017-11-16 11:07:20 +00:00
Patrick Welche
b5733ecc76 Solaris build fix
On Solaris sigset_t is only defined in /usr/include/sys/signal.h
(included from /usr/include/signal.h) if _XPG4_2 is defined. If
it's not defined, you need to include /usr/include/sys/select.h.

http://bugzilla.gnome.org/show_bug.cgi?id=562334
2017-11-16 10:36:13 +00:00
Matthias Clasen
b2a0057c14 2.55.0 2017-11-15 22:00:19 -05:00
Philip Withnall
d4f07f21fb glocalfile: Fix leak of FS type on some platforms
fstype is a const char*, and is passed to
g_file_info_set_attribute_string(), which takes a copy of it. There’s no
need to g_strdup() the FS type from various statfs/statvfs buffers
beforehand, given that the buffers are valid for the duration of this
function.

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

https://bugzilla.gnome.org/show_bug.cgi?id=679347
2017-11-15 13:08:11 +00:00
Ryan Lortie
c64b6da33c gsignal: add assert on closure invalidate path
It's theoretically possible that we could have a case where this would
actually return NULL, but it's difficult to imagine a valid program that
would contain such a case.

Add an explicit assert here to quiet up static analysis.

See the bug for more discussion.

Coverity CID: 1159477

https://bugzilla.gnome.org/show_bug.cgi?id=730296
2017-11-15 12:51:12 +00:00
Christian Hergert
ed78f30c5e file: add tests for g_file_load_bytes()
This adds a test for both g_file_load_bytes() and the
asynchronous form g_file_load_bytes_async().

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 04:10:23 -08:00
Christian Hergert
2227918dfd file: add g_file_load_bytes()
This adds g_file_load_bytes() to make it more convenient to
load the contents of a GFile as GBytes.

It includes a special casing for gresources to increase the
chances that the GBytes directly references the embedded data
instead of copying to the heap.

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 03:52:41 -08:00
Christian Hergert
5464461e4c gresource: avoid allocations in enumerate_children()
In the vast majority of cases, we can avoid temporary
allocations for paths in g_resources_enumerate_children().

In the case we need to add a suffix "/", we can usually just
build the path on the stack. In other cases, we can completely
avoid the strdup, which appears to only have been added for
readability. If the path is really long, we fallback to doing
what we did before, and use g_strconcat().

In the case of Builder, this saved 5.3mb of temporary
allocations in the process of showing the first application
window.

https://bugzilla.gnome.org/show_bug.cgi?id=790275
2017-11-15 03:24:29 -08:00
Christian Hergert
38ffcd298c gresourcefile: simplify path canonicalization
Previously, the path canonicalization for resources had liberal use of
strlen() and memmove() while walking through the path. This patch avoids
any secondary strlen() and removes all use of memmove().

A single allocation is created up front as we should only ever need one
additional byte more than then length of the incoming path string.

To keep the implementation readable, the mechanics are kept in external
functions. memrchr() was not used due to its lack of portability.

This is faster in every test case I've tested. Paths that contain
relative ../ have the most speedup.

https://bugzilla.gnome.org/show_bug.cgi?id=790310
2017-11-14 15:13:44 -08:00
Sebastian Dröge
7b60708204 GResource – Create an internal copy of the GBytes if it is not pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:39:45 +02:00
Sebastian Dröge
3c9c01e3ce GResource – Add note to documentation that the memory must be at least pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:19:58 +02:00
Philip Withnall
880f07f94c gstrfuncs: Use curly quotes in a documentation comment
Nobody can argue with this: the documentation comment is about, and
contains, Unicode accents.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-13 10:37:11 +00:00
Philip Withnall
e61c3c628d gstrfuncs: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-13 10:35:41 +00:00
Stefan Sauer
c68f66c19e docs: fix 'emphasis' tag
There is no 'em' tag in docbook. Use 'emphasis'. This would also require
to enable --xml-mode in MKDB_OPTIONS, but that requires more cleanups.
2017-11-12 21:04:30 +01:00
Stefan Sauer
2812219adb docs: add missing '*' chars at start of doc-comments 2017-11-12 16:36:16 +01:00
Kjartan Maraas
e7adf0a1a3 Updated Norwegian bokmål translation. 2017-11-11 17:09:32 +01:00
Philip Withnall
1897e66dce build: Drop data-to-c.pl in favour of data-to-c.py
The Python version was added for the Meson build, but we might as well
use it from autotools too, since it does exactly the same thing as the
Perl version (modulo not including a trailing linebreak, but that
doesn’t matter).

Works fine with Python 2.7 or Python 3.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790147
2017-11-10 11:47:57 +00:00
Philip Withnall
63e9d109fd gmessages: Give examples of G_DEBUG with gdb in the documentation
Some of the documentation linked to information about G_DEBUG already,
but most of it didn’t, and there were no examples. People need obvious
examples.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790157
2017-11-10 10:27:26 +00:00
Philip Withnall
b778ba3e64 gmessages: Improve formatting of a #define in the docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790157
2017-11-10 10:27:26 +00:00
Tim-Philipp Müller
7f9b886c9b meson: dist python script used also in autotools-generated tarball
https://bugzilla.gnome.org/show_bug.cgi?id=790126
2017-11-10 01:01:46 +01:00
Christian Kellner
b9b7a1d039 gio-tool: fix inverted logic in monitor tool
The tool should refuse to work if none of the locations to watch
are set, not if *any* of them are unset.

https://bugzilla.gnome.org/show_bug.cgi?id=790093
2017-11-09 10:47:14 +01:00
Steve Lhomme
74c5e785d3 gmessages: Mark non-varargs log functions as static inline
Certain compilers warn about unused functions if they are declared in
the header but are not inline. We require `static inline` support from
all compilers now.

Typically, this code will not be used, as the compilers we care about
implement vararg macro support; but this code path can still be hit on
some compilers (probably; unverified).

(Commit message by Philip Withnall.)

https://bugzilla.gnome.org/show_bug.cgi?id=483341
2017-11-08 13:07:56 +00:00
Sanjeev
cd0bbbf1ef gvariant: Fix minor memory leak on error handling path
(Commit message by Philip Withnall.)

https://bugzilla.gnome.org/show_bug.cgi?id=760022
2017-11-08 12:36:26 +00:00
Cosimo Cecchi
5ebd8f6e88 gmain: add g_clear_handle_id API
It's a very common pattern to see code that looks like this in
dispose() or finalize() implementations:

if (priv->source_id > 0)
  {
    g_source_remove (priv->source_id);
    priv->source_id = 0;
  }

This API allows to accomplish the same goal with a single line:

g_clear_handle_id (&priv->source_id, (GClearHandleFunc) g_source_remove);

Thanks to Emmanuele Bassi <ebassi@gnome.org> for making the patch
generic.

https://bugzilla.gnome.org/show_bug.cgi?id=788489
2017-11-07 08:28:45 -08:00