[gobject-introspection/ebassi/property-annotation: 14/17] Use a macro for the missing accessor sentinel value




commit 5583914395e485481051d8ed1ac3654b3c9bdafc
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jun 28 23:22:35 2021 +0100

    Use a macro for the missing accessor sentinel value
    
    Easier to read than `0x3ff`.

 girepository/gipropertyinfo.c     | 8 ++++----
 girepository/girnode.c            | 4 ++--
 girepository/gitypelib-internal.h | 6 ++++--
 3 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c
index 9b854b90..4a291a06 100644
--- a/girepository/gipropertyinfo.c
+++ b/girepository/gipropertyinfo.c
@@ -142,7 +142,7 @@ g_property_info_get_ownership_transfer (GIPropertyInfo *info)
  * The setter is only available for %G_PARAM_WRITABLE properties that
  * 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.
  */
 GIFunctionInfo *
@@ -160,7 +160,7 @@ g_property_info_get_setter (GIPropertyInfo *info)
   if (!blob->writable || blob->construct_only)
     return NULL;
 
-  if (blob->setter == 0x3ff)
+  if (blob->setter == ACCESSOR_SENTINEL)
     return NULL;
 
   container = rinfo->container;
@@ -181,7 +181,7 @@ g_property_info_get_setter (GIPropertyInfo *info)
  *
  * 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.
  */
 GIFunctionInfo *
@@ -199,7 +199,7 @@ g_property_info_get_getter (GIPropertyInfo *info)
   if (!blob->readable)
     return NULL;
 
-  if (blob->getter == 0x3ff)
+  if (blob->getter == ACCESSOR_SENTINEL)
     return NULL;
 
   container = rinfo->container;
diff --git a/girepository/girnode.c b/girepository/girnode.c
index 8e00447c..f7726610 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -1642,7 +1642,7 @@ _g_ir_node_build_typelib (GIrNode         *node,
             blob->setter = (guint) index;
           }
         else
-          blob->setter = 0x3ff; /* max of 10 bits */
+          blob->setter = ACCESSOR_SENTINEL;
 
         if (prop->getter != NULL)
           {
@@ -1657,7 +1657,7 @@ _g_ir_node_build_typelib (GIrNode         *node,
             blob->getter = (guint) index;
           }
         else
-          blob->getter = 0x3ff;
+          blob->getter = ACCESSOR_SENTINEL;
 
         _g_ir_node_build_typelib ((GIrNode *)prop->type,
                                 node, build, offset, offset2, NULL);
diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h
index 0f044902..398d71cb 100644
--- a/girepository/gitypelib-internal.h
+++ b/girepository/gitypelib-internal.h
@@ -903,6 +903,8 @@ typedef struct {
   ValueBlob values[];
 } EnumBlob;
 
+#define ACCESSOR_SENTINEL       0x3ff
+
 /**
  * PropertyBlob:
  * @name: The name of the property.
@@ -919,9 +921,9 @@ typedef struct {
  *   This is typically the case when reading lists of statically allocated
  *   things.
  * @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
- *   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.
  * @reserved2: Reserved for future use.
  * @type: Describes the type of the property.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]