Many (if not "almost all") programs that spawn other programs via
g_spawn_sync() or the like simply want to check whether or not the
child exited successfully, but doing so requires use of
platform-specific functionality and there's actually a fair amount of
boilerplate involved.
This new API will help drain a *lot* of mostly duplicated code in
GNOME, from gnome-session to gdm. And we can see that some bits even
inside GLib were doing it wrong; for example checking the exit status
on Unix, but ignoring it on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=679691
We need to do this because constructors run before main() and
thus before any call to g_mem_set_vtable, making it impossible to
use that function if constructors call g_malloc.
We do this by making the constructors just register the static data
for lazy registration, doing the lazy registration when using
the global resource set.
With this we're not longer exporting the constructor headers, which means
we're not tying ourselves to a macro that might need special tweaking on
a compiler-by-compiler basis.
It's hardly useful to bloat the resource data with blanks intended only
for human readability, so add a preprocessing option that uses xmllint --noblanks
to strip these.
Bug #667929.
==13007== 173 bytes in 1 blocks are definitely lost in loss record 90 of 106
==13007== at 0x402AD89: malloc (vg_replace_malloc.c:236)
==13007== by 0x407DDBA: standard_malloc (gmem.c:85)
==13007== by 0x407E318: g_try_malloc (gmem.c:271)
==13007== by 0x40654DE: g_file_get_contents (gfileutils.c:756)
==13007== by 0x804A531: main (glib-compile-resources.c:580)
==13007== 521 (56 direct, 465 indirect) bytes in 1 blocks are definitely lost in loss record 100 of 106
==13007== at 0x402AD89: malloc (vg_replace_malloc.c:236)
==13007== by 0x407DDBA: standard_malloc (gmem.c:85)
==13007== by 0x407E160: g_malloc (gmem.c:159)
==13007== by 0x4091D8D: g_slice_alloc (gslice.c:1003)
==13007== by 0x40674A1: g_hash_table_new_full (ghash.c:676)
==13007== by 0x804B252: gvdb_hash_table_new (gvdb-builder.c:76)
==13007== by 0x43C66B2: (below main) (libc-start.c:226)
Initial underscores are used in c identifier to make them private,
for instance in Gtk+. However, we don't want to have this in the
resource section name, that just looks ugly.