girepository: constify iterator arguments

This is an API break, but libgirepository has not been in a stable
release yet, so that’s fine.

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

Helps: #3155
This commit is contained in:
Philip Withnall 2023-12-12 17:34:48 +00:00
parent 5fa28d1b7e
commit 825581756a
5 changed files with 18 additions and 18 deletions

View File

@ -747,7 +747,7 @@ gi_base_info_get_attribute (GIBaseInfo *info,
const gchar *name)
{
GIAttributeIter iter = { 0, };
gchar *curname, *curvalue;
const char *curname, *curvalue;
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
{
if (strcmp (name, curname) == 0)
@ -832,8 +832,8 @@ _attribute_blob_find_first (GIBaseInfo *info,
* print_attributes (GIBaseInfo *info)
* {
* GIAttributeIter iter = { 0, };
* char *name;
* char *value;
* const char *name;
* const char *value;
* while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
* {
* g_print ("attribute name: %s value: %s", name, value);
@ -846,8 +846,8 @@ _attribute_blob_find_first (GIBaseInfo *info,
gboolean
gi_base_info_iterate_attributes (GIBaseInfo *info,
GIAttributeIter *iterator,
gchar **name,
gchar **value)
const gchar **name,
const gchar **value)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
@ -864,8 +864,8 @@ gi_base_info_iterate_attributes (GIBaseInfo *info,
if (next == NULL || next->offset != rinfo->offset || next >= after)
return FALSE;
*name = (gchar*) gi_typelib_get_string (rinfo->typelib, next->name);
*value = (gchar*) gi_typelib_get_string (rinfo->typelib, next->value);
*name = gi_typelib_get_string (rinfo->typelib, next->name);
*value = gi_typelib_get_string (rinfo->typelib, next->value);
iterator->data = next + 1;
return TRUE;

View File

@ -79,8 +79,8 @@ const gchar * gi_base_info_get_attribute (GIBaseInfo *info,
GI_AVAILABLE_IN_ALL
gboolean gi_base_info_iterate_attributes (GIBaseInfo *info,
GIAttributeIter *iterator,
char **name,
char **value);
const char **name,
const char **value);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_base_info_get_container (GIBaseInfo *info);

View File

@ -411,7 +411,7 @@ gi_callable_info_get_return_attribute (GICallableInfo *info,
const gchar *name)
{
GIAttributeIter iter = { 0, };
gchar *curname, *curvalue;
const char *curname, *curvalue;
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
{
if (g_strcmp0 (name, curname) == 0)
@ -443,8 +443,8 @@ gi_callable_info_get_return_attribute (GICallableInfo *info,
gboolean
gi_callable_info_iterate_return_attributes (GICallableInfo *info,
GIAttributeIter *iterator,
char **name,
char **value)
const char **name,
const char **value)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
@ -464,8 +464,8 @@ gi_callable_info_iterate_return_attributes (GICallableInfo *info,
if (next == NULL || next->offset != blob_offset || next >= after)
return FALSE;
*name = (gchar*) gi_typelib_get_string (rinfo->typelib, next->name);
*value = (gchar*) gi_typelib_get_string (rinfo->typelib, next->value);
*name = gi_typelib_get_string (rinfo->typelib, next->name);
*value = gi_typelib_get_string (rinfo->typelib, next->value);
iterator->data = next + 1;
return TRUE;

View File

@ -65,8 +65,8 @@ const gchar * gi_callable_info_get_return_attribute (GICallableInfo *in
GI_AVAILABLE_IN_ALL
gboolean gi_callable_info_iterate_return_attributes (GICallableInfo *info,
GIAttributeIter *iterator,
char **name,
char **value);
const char **name,
const char **value);
GI_AVAILABLE_IN_ALL
GITransfer gi_callable_info_get_caller_owns (GICallableInfo *info);

View File

@ -352,7 +352,7 @@ write_attributes (Xml *file,
GIBaseInfo *info)
{
GIAttributeIter iter = { 0, };
char *name, *value;
const char *name, *value;
while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
{
@ -367,7 +367,7 @@ write_return_value_attributes (Xml *file,
GICallableInfo *info)
{
GIAttributeIter iter = { 0, };
char *name, *value;
const char *name, *value;
while (gi_callable_info_iterate_return_attributes (info, &iter, &name, &value))
{