Method
GLib StrvBuilderunref_to_strv
since: 2.82
Declaration [src]
GStrv
g_strv_builder_unref_to_strv(
GStrvBuilder*builder
)
Description [src]
Decreases the reference count on the string vector builder, and returns
its contents as a NULL-terminated string array.
This function is especially useful for cases where it’s not possible
to use g_autoptr().
GStrvBuilder*builder=g_strv_builder_new();
g_strv_builder_add(builder,"hello");
g_strv_builder_add(builder,"world");
GStrvarray=g_strv_builder_unref_to_strv(builder);
g_assert_true(g_strv_equal(array,(constchar*[]){"hello","world",NULL}));
g_strfreev(array);
Available since: 2.82
Parameters
builder-
Type:
GStrvBuilderA
GStrvBuilder.The instance takes ownership of the data, and is responsible for freeing it.
Return value
Type: An array of utf8
The constructed string array.
The array is
NULL-terminated. Each element is a NUL terminated UTF-8 string.