When the flags enum only has the default NONE = 0 entry, glib-mkenums
creates an enum type for it, not a flags type. Add an annotation to the
enum to ensure the correct GType is created.
Bug #667938.
This is particular useful for:
g_array_new (sizeof (MyStruct), FALSE, FALSE);
because the correct incantation is
g_array_new (FALSE, FALSE, sizeof (MyStruct));
and these warnings will trigger in the first situation.
... and g_value_get_gtype(). G_TYPE_GTYPE is a pointer type, so it's
values should use the v_pointer member. This is especially true, because
the value collectors from varargs in gvaluecollector.h use that, too.
This should only cause issues when sizeof(glong) != sizeof(gpointer),
and I'm not aware of any such platform. Maybe win64?
GResource is a bundle of files combined into a single binary blog.
The API lets you access the files the resource contains by
using resource paths. You can also register resources with a
global list and access these globally in a merged resource namespace.
The normal way this is used is to link in the resources into your
application/library and have it be automatically registred.
Resources are compiled from an xml description using
glib-compile-resources.
This is only supported on some compilers, so we define G_HAS_CONSTRUCTORS
when it is supported. However, when it is supported we guarantee that
both constructors and destructors work, in executables as well as shared
libraries (including runtime unloading of shared libraries).
Usage is a bit unorthodox, as some compilers need to use #pragma to
implement constructors, and #pragma can't be used in macros.
The canonical way to use this:
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
#endif
G_DEFINE_CONSTRUCTOR(my_constructor)
static void my_constructor (void)
{
...
#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(my_destructor)
#endif
G_DEFINE_DESTRUCTOR(my_destructor)
static void my_destructor (void)
{
...
This is implemented by with statfs_buffer.f_bavail (free blocks
for unprivileged users) as a default way to retrieve real free space.
Based on a patch by Marcus Carlson, bug 625751.
g_thread_init() has done nothing since 2.32, so while the function
still can be used if "g_thread_init() has not yet been called",
it won't do nothing in that case, it will just perform normally.