Commit Graph

17613 Commits

Author SHA1 Message Date
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
Cosimo Cecchi
44d6052584 gfile: add g_file_new_build_filename()
This is a convenience C API that combines g_build_filename() with
g_file_new_for_path().

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Cosimo Cecchi
374ade1b68 glib: add g_build_filename_valist()
A new public API convenience to build a filename from a va_list.

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Cosimo Cecchi
68d62c33fd gfileutils: factor out g_build_filename_va()
This will be used in a later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Philip Withnall
8e8f4e6486 docs: Fix various minor syntax errors in gtk-doc comments
This will fix a few broken links in the documentation, and shut up a
load of gtk-doc warnings (but certainly not all of them).

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

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:51:12 +00:00
Philip Withnall
249d74fcf6 docs: Make argument names in GAppInfo consistent
This fixes a mismatch between some of the gtk-doc comments and reality.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Philip Withnall
a12fbd227f docs: Add version and deprecation decorators to gtk-doc ignore list
This allows gtk-doc to recognise a whole lot more API than it could
before. Maintaining the lists between 6 build files is going to be a bit
of a pain, but they only need to be modified once a cycle.

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

https://bugzilla.gnome.org/show_bug.cgi?id=789087

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Philip Withnall
f33ca578b1 docs: Add 2.56 to the API version reference in glib-docs.xml
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Philip Withnall
6546d87e4a docs: Add recent version check macros to glib-sections.txt
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Ondrej Holy
796599a705 gio-tool: Do not alter uris before use
Uris may be altered by the following code, which breaks xdg-open:
file = g_file_new_for_commandline_arg (arg[i])
uri = g_file_get_uri (file);

Examples of possible uri changes:
mailto:email -> mailto:///email
magnet:?xt=urn:hash -> magnet:///?xt=urn:hash
ssh://user@host -> sftp://user@host

This patch causes that uris aren't preprocessed for locations with
scheme, however absolute and relative paths are still preprocessed.

https://bugzilla.gnome.org/show_bug.cgi?id=779182
2017-11-07 13:46:56 +01:00
Philip Withnall
fac219adf8 tests: Fix a couple of bug base URIs
bugs.gnome.org doesn’t redirect properly any more (and isn’t HTTPS).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-07 11:45:53 +00:00
Philip Withnall
cfe41f4ced build: Fix a broken link in an error message from configure.ac
Spotted in bug #742548.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-07 11:45:29 +00:00
Kjartan Maraas
90d8058f7a Updated Norwegian bokmål translation. 2017-11-06 13:56:36 +01:00
Colin Walters
cb8bfa758f gdbus-codegen: Call abspath() earlier
The previous change from https://bugzilla.gnome.org/show_bug.cgi?id=786785
didn't actually work (for me at least) in the `/bin/gdbus-codegen` case
as the relative `/bin/../share` path works, but then `os.path.abspath()`
breaks it (as it's not doing `realpath()`, and let's not go there).

Fix this by doing the `abspath` first.

Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1507661

https://bugzilla.gnome.org/show_bug.cgi?id=789723
2017-11-06 11:57:52 +00:00
Philip Withnall
0d49cd1b11 gutils: Fix minor memory leak on error path
Introduced in commit d011223085.

Coverity CID: 1382472

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-06 10:31:52 +00:00
Rico Tzschichholz
df66b25301 GSeekable: Fix g_seekable_truncate invoker reference
https://bugzilla.gnome.org/show_bug.cgi?id=573251
2017-11-04 20:05:37 +01:00
Daniel Macks
0091f7f212 Use __APPLE__ token to control OSX-specific tests
The carbon framework is deprecated and not really related to OSX's
printf features. Directly test compiler-defined token for the platform
itself rather than that autodetected framework as a proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=731625
2017-11-03 20:19:58 +00:00
Daniel Macks
d88d90c3c8 Exec=true (seach via PATH) instead of hardcoding /bin/true
...otherwise this .desktop is omitted on platforms that have it
elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=731705
2017-11-03 20:16:52 +00:00
Martin
029cfa9109 build: Ensure .py files are generated at build time not install time
Otherwise installing with `sudo make install` fails.

https://bugzilla.gnome.org/show_bug.cgi?id=706667
2017-11-03 20:11:56 +00:00
Uwe Helm
5448ef5326 gio: Add FS magic number for FUSE
https://bugzilla.gnome.org/show_bug.cgi?id=740826
2017-11-03 19:50:19 +00:00
Philip Withnall
fc817eb38a gthread: Emit a critical if g_rw_lock_reader_lock() fails
It can only fail if there’s been a leak or programmer error, so this is
really unlikely to happen. At least make it obvious something has gone
wrong, though, rather than silently carrying on and returning as if the
reader lock has been acquired.

Do the same for g_rw_lock_writer_lock().

It should be safe to use g_critical() for reporting the problems, since
GRWLock is not used in gmessages.c, and printing a critical seems better
than aborting, just in case we do hit the ‘maximum number of reader
locks’ error code.

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

https://bugzilla.gnome.org/show_bug.cgi?id=756430
2017-11-03 18:17:14 +00:00
Krzesimir Nowak
f5e229c76d convert: Fix tautological comparisons in tests
https://bugzilla.gnome.org/show_bug.cgi?id=767239
2017-11-03 16:43:23 +00:00
Tomas Kotal
ea2901abf8 gio: GPollFileMonitor is not cleaning up correctly
https://bugzilla.gnome.org/show_bug.cgi?id=789820
2017-11-03 14:07:57 +00:00
Philip Withnall
a6fc4daeb9 gmessages: Add timestamp to g_log_writer_format_fields()
Since journald adds a timestamp, it would be useful to add one to the
stdout/stderr output too — we do not want it to miss out on the
timestamping fun.

Make it blue, because we can.

https://bugzilla.gnome.org/show_bug.cgi?id=769846
2017-11-03 13:01:19 +00:00
Daniel Mustieles
df957fa81a Update Spanish translation 2017-11-03 12:56:09 +00:00
Jiří Techet
9bcd7800a1 gio: Eliminate warnings in cstring conversion on OS X
create_cstr_from_cfstring_with_fallback() is allowed to be called when str == NULL
but create_cstr_from_cfstring() isn't which leads to warnings in the console.
Fix this by adding NULL checks into create_cstr_from_cfstring_with_fallback().

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Jiří Techet
6acaca8831 gio: Show icons based on file's mime type on OS X
The patch basically just grabs the implementation of g_content_type_get_icon_internal()
from gcontenttype.c - the only difference is that it first converts UTI to MIME using
g_content_type_get_mime_type() and at the end frees this temporary MIME type.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Marek Cernocky
fc031daa33 Updated Czech translation 2017-11-03 12:39:23 +01:00
Mario Blättermann
6b9636469d Update German translation 2017-11-02 19:15:11 +00:00
Tom Schoonjans
719edde63b GModule win32: disable error dialog popup
When loading a module on win32, a blocking error dialog pops up whenever
the module could not be loaded. This is particularly annoying when
module loading failure is a harmless and expected event...

This patch temporarily disables these error dialogs from popping up.

https://bugzilla.gnome.org/show_bug.cgi?id=777308
2017-11-02 15:34:14 +00:00
Benoît Dejean
54f6c56235 utils: Add new G_FORMAT_SIZE_BITS flag for g_format_size_full()
It will return sizes in bits, rather than bytes.

https://bugzilla.gnome.org/show_bug.cgi?id=789170
2017-11-02 13:39:19 +00:00
Colin Walters
6036d40073 build: Work with automake 1.13.3
In https://git.gnome.org/browse/glib/commit/?id=5c13bf9bcf0 we jumped all the
way from `1.11` to `1.14`, but `1.13.3` is what's in RHEL7.4 today, and the build
seems to work fine for me with it.
2017-11-02 08:50:35 -04:00
Nirbheek Chauhan
953a51d97b meson: Fix installation of gdb autoload scripts v2
`install:` is not a valid keyword argument for configure_file()
2017-11-02 10:22:39 +05:30
Nirbheek Chauhan
625bfa0b36 meson: Fix comment explaining gdb hacks
https://bugzilla.gnome.org/show_bug.cgi?id=788772
2017-11-02 10:03:22 +05:30