mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 20:22:11 +01:00
gibaseinfo: Add initialiser macro for GIAttributeIter
Makes it a little easier to use. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
parent
57d64b111f
commit
9aea530ac0
@ -784,7 +784,7 @@ const char *
|
|||||||
gi_base_info_get_attribute (GIBaseInfo *info,
|
gi_base_info_get_attribute (GIBaseInfo *info,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
|
||||||
const char *curname, *curvalue;
|
const char *curname, *curvalue;
|
||||||
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
||||||
{
|
{
|
||||||
@ -872,7 +872,7 @@ _attribute_blob_find_first (GIBaseInfo *info,
|
|||||||
* void
|
* void
|
||||||
* print_attributes (GIBaseInfo *info)
|
* print_attributes (GIBaseInfo *info)
|
||||||
* {
|
* {
|
||||||
* GIAttributeIter iter = { 0, };
|
* GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
|
||||||
* const char *name;
|
* const char *name;
|
||||||
* const char *value;
|
* const char *value;
|
||||||
* while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
|
* while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
|
||||||
|
@ -48,6 +48,16 @@ typedef struct {
|
|||||||
void *_dummy[4];
|
void *_dummy[4];
|
||||||
} GIAttributeIter;
|
} GIAttributeIter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GI_ATTRIBUTE_ITER_INIT:
|
||||||
|
*
|
||||||
|
* Initialise a stack-allocated [type@GIRepository.AttributeIter] to a value
|
||||||
|
* suitable for passing to the first call to an ‘iterate’ function.
|
||||||
|
*
|
||||||
|
* Since: 2.80
|
||||||
|
*/
|
||||||
|
#define GI_ATTRIBUTE_ITER_INIT { NULL, { NULL, } }
|
||||||
|
|
||||||
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +426,7 @@ const char *
|
|||||||
gi_callable_info_get_return_attribute (GICallableInfo *info,
|
gi_callable_info_get_return_attribute (GICallableInfo *info,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
|
||||||
const char *curname, *curvalue;
|
const char *curname, *curvalue;
|
||||||
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
|
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ static void
|
|||||||
write_attributes (Xml *file,
|
write_attributes (Xml *file,
|
||||||
GIBaseInfo *info)
|
GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
|
||||||
const char *name, *value;
|
const char *name, *value;
|
||||||
|
|
||||||
while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
|
while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
|
||||||
@ -365,7 +365,7 @@ static void
|
|||||||
write_return_value_attributes (Xml *file,
|
write_return_value_attributes (Xml *file,
|
||||||
GICallableInfo *info)
|
GICallableInfo *info)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
|
||||||
const char *name, *value;
|
const char *name, *value;
|
||||||
|
|
||||||
while (gi_callable_info_iterate_return_attributes (info, &iter, &name, &value))
|
while (gi_callable_info_iterate_return_attributes (info, &iter, &name, &value))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user