Skip to content

gitypeinfo: Add pointer-stuffing functions for GITypeTag storage type

This adds gi_storage_type_argument_from_hash_pointer() and gi_storage_type_hash_pointer_from_argument(). They do the same thing as the corresponding g_type_info_... functions, which are used to pack and unpack the correct field of a GIArgument into/from a data pointer in GHashTable or GList, regardless of machine architecture or endianness.

These functions take a GITypeTag obtained from g_type_info_get_storage_type(), instead of a GITypeInfo pointer. (The storage type is the only piece of data that is actually used from the GITypeInfo structure.)

It's intended for bindings using an argument cache, such as GJS and PyGObject, so that they don't have to store a whole 64-bit GITypeInfo pointer in their cache in many common cases, and can just store the 5-bit type tag instead.

The original g_type_info_... functions are reimplemented in terms of the new gi_storage_type... functions.

Merge request reports