mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
Move GStrv typedef to glib.h instead of gobject.h
GStrv was historically only needed for the boxed G_TYPE_STRV, but it is now useful for g_auto(GStrv) as well. This is not an ABI change. https://bugzilla.gnome.org/show_bug.cgi?id=755355
This commit is contained in:
parent
32811598f3
commit
b81f3ced71
@ -1453,6 +1453,9 @@ g_strfreev
|
||||
g_strconcat
|
||||
g_strjoin
|
||||
g_strjoinv
|
||||
|
||||
<SUBSECTION>
|
||||
GStrv
|
||||
g_strv_length
|
||||
g_strv_contains
|
||||
|
||||
|
@ -398,7 +398,6 @@ G_TYPE_SOURCE
|
||||
G_TYPE_POLLFD
|
||||
G_TYPE_THREAD
|
||||
G_TYPE_OPTION_GROUP
|
||||
GStrv
|
||||
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_IS_BOXED
|
||||
|
@ -2343,8 +2343,10 @@
|
||||
* {
|
||||
* g_auto(GQueue) queue = G_QUEUE_INIT;
|
||||
* g_auto(GVariantBuilder) builder;
|
||||
* g_auto(GStrv) strv;
|
||||
*
|
||||
* g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
|
||||
* strv = g_strsplit("a:b:c", ":", -1);
|
||||
*
|
||||
* ...
|
||||
*
|
||||
|
@ -86,3 +86,4 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
|
||||
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
|
||||
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
|
||||
|
@ -2458,6 +2458,13 @@ g_strsplit_set (const gchar *string,
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* GStrv:
|
||||
*
|
||||
* A typedef alias for gchar**. This is mostly useful when used together with
|
||||
* g_auto().
|
||||
*/
|
||||
|
||||
/**
|
||||
* g_strfreev:
|
||||
* @str_array: a %NULL-terminated array of strings to free
|
||||
|
@ -265,6 +265,7 @@ gpointer g_memdup (gconstpointer mem,
|
||||
* g_strdupv() copies a NULL-terminated array of strings
|
||||
* g_strv_length() returns the length of a NULL-terminated array of strings
|
||||
*/
|
||||
typedef gchar** GStrv;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gchar** g_strsplit (const gchar *string,
|
||||
const gchar *delimiter,
|
||||
|
@ -398,6 +398,13 @@ test_g_variant_type (void)
|
||||
g_assert (val != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_strv (void)
|
||||
{
|
||||
g_auto(GStrv) val = g_strsplit("a:b:c", ":", -1);
|
||||
g_assert (val != NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
@ -449,6 +456,7 @@ main (int argc, gchar *argv[])
|
||||
g_test_add_func ("/autoptr/g_variant_iter", test_g_variant_iter);
|
||||
g_test_add_func ("/autoptr/g_variant_dict", test_g_variant_dict);
|
||||
g_test_add_func ("/autoptr/g_variant_type", test_g_variant_type);
|
||||
g_test_add_func ("/autoptr/strv", test_strv);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@ -357,13 +357,6 @@ GType g_option_group_get_type (void) G_GNUC_CONST;
|
||||
GLIB_DEPRECATED_FOR('G_TYPE_VARIANT')
|
||||
GType g_variant_get_gtype (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* GStrv:
|
||||
*
|
||||
* A C representable type name for #G_TYPE_STRV.
|
||||
*/
|
||||
typedef gchar** GStrv;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIB_TYPES_H__ */
|
||||
|
@ -21,7 +21,6 @@
|
||||
#error "Only <glib-object.h> can be included directly."
|
||||
#endif
|
||||
|
||||
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
|
||||
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)
|
||||
|
Loading…
Reference in New Issue
Block a user