Use a macro for the missing accessor sentinel value

Easier to read than `0x3ff`.
This commit is contained in:
Emmanuele Bassi 2021-06-28 23:22:35 +01:00
parent 400dfc2908
commit 493441c84d
3 changed files with 10 additions and 8 deletions

View File

@ -142,7 +142,7 @@ g_property_info_get_ownership_transfer (GIPropertyInfo *info)
* The setter is only available for %G_PARAM_WRITABLE properties that * The setter is only available for %G_PARAM_WRITABLE properties that
* are also not %G_PARAM_CONSTRUCT_ONLY. * are also not %G_PARAM_CONSTRUCT_ONLY.
* *
* Returns: (transfer full): the function info or %NULL if not set. * Returns: (transfer full) (nullable): the function info or %NULL if not set.
* Free it with g_base_info_unref() when done. * Free it with g_base_info_unref() when done.
*/ */
GIFunctionInfo * GIFunctionInfo *
@ -160,7 +160,7 @@ g_property_info_get_setter (GIPropertyInfo *info)
if (!blob->writable || blob->construct_only) if (!blob->writable || blob->construct_only)
return NULL; return NULL;
if (blob->setter == 0x3ff) if (blob->setter == ACCESSOR_SENTINEL)
return NULL; return NULL;
container = rinfo->container; container = rinfo->container;
@ -181,7 +181,7 @@ g_property_info_get_setter (GIPropertyInfo *info)
* *
* The setter is only available for %G_PARAM_READABLE properties. * The setter is only available for %G_PARAM_READABLE properties.
* *
* Returns: (transfer full): the function info or %NULL if not set. * Returns: (transfer full) (nullable): the function info or %NULL if not set.
* Free it with g_base_info_unref() when done. * Free it with g_base_info_unref() when done.
*/ */
GIFunctionInfo * GIFunctionInfo *
@ -199,7 +199,7 @@ g_property_info_get_getter (GIPropertyInfo *info)
if (!blob->readable) if (!blob->readable)
return NULL; return NULL;
if (blob->getter == 0x3ff) if (blob->getter == ACCESSOR_SENTINEL)
return NULL; return NULL;
container = rinfo->container; container = rinfo->container;

View File

@ -1642,7 +1642,7 @@ _g_ir_node_build_typelib (GIrNode *node,
blob->setter = (guint) index; blob->setter = (guint) index;
} }
else else
blob->setter = 0x3ff; /* max of 10 bits */ blob->setter = ACCESSOR_SENTINEL;
if (prop->getter != NULL) if (prop->getter != NULL)
{ {
@ -1657,7 +1657,7 @@ _g_ir_node_build_typelib (GIrNode *node,
blob->getter = (guint) index; blob->getter = (guint) index;
} }
else else
blob->getter = 0x3ff; blob->getter = ACCESSOR_SENTINEL;
_g_ir_node_build_typelib ((GIrNode *)prop->type, _g_ir_node_build_typelib ((GIrNode *)prop->type,
node, build, offset, offset2, NULL); node, build, offset, offset2, NULL);

View File

@ -903,6 +903,8 @@ typedef struct {
ValueBlob values[]; ValueBlob values[];
} EnumBlob; } EnumBlob;
#define ACCESSOR_SENTINEL 0x3ff
/** /**
* PropertyBlob: * PropertyBlob:
* @name: The name of the property. * @name: The name of the property.
@ -919,9 +921,9 @@ typedef struct {
* This is typically the case when reading lists of statically allocated * This is typically the case when reading lists of statically allocated
* things. * things.
* @setter: the index of the setter function for this property, if @writable * @setter: the index of the setter function for this property, if @writable
* is set; if the method is not known, the value will be set to 0x3ff * is set; if the method is not known, the value will be set to %ACCESSOR_SENTINEL
* @getter: ths index of the getter function for this property, if @readable * @getter: ths index of the getter function for this property, if @readable
* is set; if the method is not known, the value will be set to 0x3ff * is set; if the method is not known, the value will be set to %ACCESSOR_SENTINEL
* @reserved: Reserved for future use. * @reserved: Reserved for future use.
* @reserved2: Reserved for future use. * @reserved2: Reserved for future use.
* @type: Describes the type of the property. * @type: Describes the type of the property.