girnode: Document ownership and element types of internal structs

This is just for future reference for people reading the code in future.
I was going through and checking to see if any of them needed to be made
`const` (none of them did).

I did find a couple of memory leaks though; see the following commits.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2024-01-25 22:54:25 +00:00
parent 7262f5ab14
commit 2c2712e310

View File

@ -94,19 +94,19 @@ typedef enum
struct _GIIrNode struct _GIIrNode
{ {
GIIrNodeTypeId type; GIIrNodeTypeId type;
char *name; char *name; /* (owned) */
GIIrModule *module; GIIrModule *module; /* (unowned) */
uint32_t offset; /* Assigned as we build the typelib */ uint32_t offset; /* Assigned as we build the typelib */
GHashTable *attributes; GHashTable *attributes; /* (element-type utf8 utf8) (owned) */
}; };
struct _GIIrNodeXRef struct _GIIrNodeXRef
{ {
GIIrNode node; GIIrNode node;
char *namespace; char *namespace; /* (owned) */
}; };
struct _GIIrNodeFunction struct _GIIrNodeFunction
@ -124,11 +124,11 @@ struct _GIIrNodeFunction
uint8_t throws : 1; uint8_t throws : 1;
uint8_t instance_transfer_full : 1; uint8_t instance_transfer_full : 1;
char *symbol; char *symbol; /* (owned) */
char *property; char *property; /* (owned) */
GIIrNodeParam *result; GIIrNodeParam *result; /* (owned) */
GList *parameters; GList *parameters; /* (element-type GIIrNode) (owned) */
}; };
struct _GIIrNodeType struct _GIIrNodeType
@ -145,7 +145,7 @@ struct _GIIrNodeType
uint8_t is_error : 1; uint8_t is_error : 1;
int tag; int tag;
char *unparsed; char *unparsed; /* (owned) */
uint8_t zero_terminated : 1; uint8_t zero_terminated : 1;
uint8_t has_length : 1; uint8_t has_length : 1;
@ -154,11 +154,11 @@ struct _GIIrNodeType
int size; int size;
int array_type; int array_type;
GIIrNodeType *parameter_type1; GIIrNodeType *parameter_type1; /* (owned) */
GIIrNodeType *parameter_type2; GIIrNodeType *parameter_type2; /* (owned) */
char *giinterface; char *giinterface; /* (owned) */
char **errors; char **errors; /* (array zero-terminated=1) (owned) */
}; };
struct _GIIrNodeParam struct _GIIrNodeParam
@ -179,7 +179,7 @@ struct _GIIrNodeParam
int8_t closure; int8_t closure;
int8_t destroy; int8_t destroy;
GIIrNodeType *type; GIIrNodeType *type; /* (owned) */
}; };
struct _GIIrNodeProperty struct _GIIrNodeProperty
@ -188,7 +188,7 @@ struct _GIIrNodeProperty
uint8_t deprecated : 1; uint8_t deprecated : 1;
char *name; char *name; /* (owned) */
uint8_t readable : 1; uint8_t readable : 1;
uint8_t writable : 1; uint8_t writable : 1;
uint8_t construct : 1; uint8_t construct : 1;
@ -196,10 +196,10 @@ struct _GIIrNodeProperty
uint8_t transfer : 1; uint8_t transfer : 1;
uint8_t shallow_transfer : 1; uint8_t shallow_transfer : 1;
char *setter; char *setter; /* (owned) */
char *getter; char *getter; /* (owned) */
GIIrNodeType *type; GIIrNodeType *type; /* (owned) */
}; };
struct _GIIrNodeSignal struct _GIIrNodeSignal
@ -222,8 +222,8 @@ struct _GIIrNodeSignal
int class_closure; int class_closure;
GList *parameters; GList *parameters; /* (element-type GIIrNode) (owned) */
GIIrNodeParam *result; GIIrNodeParam *result; /* (owned) */
}; };
struct _GIIrNodeVFunc struct _GIIrNodeVFunc
@ -238,10 +238,10 @@ struct _GIIrNodeVFunc
uint8_t throws : 1; uint8_t throws : 1;
uint8_t instance_transfer_full : 1; uint8_t instance_transfer_full : 1;
char *invoker; char *invoker; /* (owned) */
GList *parameters; GList *parameters; /* (element-type GIIrNode) (owned) */
GIIrNodeParam *result; GIIrNodeParam *result; /* (owned) */
int offset; int offset;
}; };
@ -254,9 +254,9 @@ struct _GIIrNodeField
uint8_t writable : 1; uint8_t writable : 1;
int bits; int bits;
int offset; int offset;
GIIrNodeFunction *callback; GIIrNodeFunction *callback; /* (owned) */
GIIrNodeType *type; GIIrNodeType *type; /* (owned) */
}; };
struct _GIIrNodeInterface struct _GIIrNodeInterface
@ -268,25 +268,25 @@ struct _GIIrNodeInterface
uint8_t fundamental : 1; uint8_t fundamental : 1;
uint8_t final_ : 1; uint8_t final_ : 1;
char *gtype_name; char *gtype_name; /* (owned) */
char *gtype_init; char *gtype_init; /* (owned) */
char *ref_func; char *ref_func; /* (owned) */
char *unref_func; char *unref_func; /* (owned) */
char *set_value_func; char *set_value_func; /* (owned) */
char *get_value_func; char *get_value_func; /* (owned) */
char *parent; char *parent; /* (owned) */
char *glib_type_struct; char *glib_type_struct; /* (owned) */
GList *interfaces; GList *interfaces; /* (element-type GIIrNode) (owned) */
GList *prerequisites; GList *prerequisites; /* (element-type utf8) (owned) */
size_t alignment; size_t alignment;
size_t size; size_t size;
GIIrOffsetsState offsets_state; GIIrOffsetsState offsets_state;
GList *members; GList *members; /* (element-type GIIrNode) (owned) */
}; };
struct _GIIrNodeValue struct _GIIrNodeValue
@ -304,9 +304,9 @@ struct _GIIrNodeConstant
uint8_t deprecated : 1; uint8_t deprecated : 1;
GIIrNodeType *type; GIIrNodeType *type; /* (owned) */
char *value; char *value; /* (owned) */
}; };
struct _GIIrNodeEnum struct _GIIrNodeEnum
@ -316,12 +316,12 @@ struct _GIIrNodeEnum
uint8_t deprecated : 1; uint8_t deprecated : 1;
int storage_type; int storage_type;
char *gtype_name; char *gtype_name; /* (owned) */
char *gtype_init; char *gtype_init; /* (owned) */
char *error_domain; char *error_domain; /* (owned) */
GList *values; GList *values; /* (element-type GIIrNode) (owned) */
GList *methods; GList *methods; /* (element-type GIIrNode) (owned) */
}; };
struct _GIIrNodeBoxed struct _GIIrNodeBoxed
@ -330,14 +330,14 @@ struct _GIIrNodeBoxed
uint8_t deprecated : 1; uint8_t deprecated : 1;
char *gtype_name; char *gtype_name; /* (owned) */
char *gtype_init; char *gtype_init; /* (owned) */
size_t alignment; size_t alignment;
size_t size; size_t size;
GIIrOffsetsState offsets_state; GIIrOffsetsState offsets_state;
GList *members; GList *members; /* (element-type GIIrNode) (owned) */
}; };
struct _GIIrNodeStruct struct _GIIrNodeStruct
@ -351,17 +351,17 @@ struct _GIIrNodeStruct
uint8_t is_gtype_struct : 1; uint8_t is_gtype_struct : 1;
uint8_t foreign : 1; uint8_t foreign : 1;
char *gtype_name; char *gtype_name; /* (owned) */
char *gtype_init; char *gtype_init; /* (owned) */
char *copy_func; char *copy_func; /* (owned) */
char *free_func; char *free_func; /* (owned) */
size_t alignment; size_t alignment;
size_t size; size_t size;
GIIrOffsetsState offsets_state; GIIrOffsetsState offsets_state;
GList *members; GList *members; /* (element-type GIIrNode) (owned) */
}; };
struct _GIIrNodeUnion struct _GIIrNodeUnion
@ -370,21 +370,21 @@ struct _GIIrNodeUnion
uint8_t deprecated : 1; uint8_t deprecated : 1;
GList *members; GList *members; /* (element-type GIIrNode) (owned) */
GList *discriminators; GList *discriminators; /* (element-type GIIrNode) (owned) */
char *gtype_name; char *gtype_name; /* (owned) */
char *gtype_init; char *gtype_init; /* (owned) */
char *copy_func; char *copy_func; /* (owned) */
char *free_func; char *free_func; /* (owned) */
size_t alignment; size_t alignment;
size_t size; size_t size;
GIIrOffsetsState offsets_state; GIIrOffsetsState offsets_state;
int discriminator_offset; int discriminator_offset;
GIIrNodeType *discriminator_type; GIIrNodeType *discriminator_type; /* (owned) */
}; };