mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gitypeinfo: Remove invalid return value from gi_type_info_get_array_type()
`-1` isn’t part of `GIArrayType`, so it’s not particularly type safe to return it from `gi_type_info_get_array_type()`. Instead, make it an error to call that function on a type which isn’t an array type. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3155
This commit is contained in:
parent
6a7806da4d
commit
33f157bd6b
@ -350,10 +350,12 @@ gi_type_info_is_zero_terminated (GITypeInfo *info)
|
||||
*
|
||||
* Obtain the array type for this type.
|
||||
*
|
||||
* See [enum@GIRepository.ArrayType] for a list of possible values. If the type
|
||||
* tag of this type is not array, `-1` will be returned.
|
||||
* See [enum@GIRepository.ArrayType] for a list of possible values.
|
||||
*
|
||||
* Returns: the array type or `-1`
|
||||
* It is an error to call this on an @info which is not an array type. Use
|
||||
* [method@GIRepository.TypeInfo.get_tag] to check.
|
||||
*
|
||||
* Returns: the array type
|
||||
* Since: 2.80
|
||||
*/
|
||||
GIArrayType
|
||||
@ -375,7 +377,8 @@ gi_type_info_get_array_type (GITypeInfo *info)
|
||||
return blob->array_type;
|
||||
}
|
||||
|
||||
return -1;
|
||||
/* Not an array type */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user