Function

GLibVariantnew_take_string

since: 2.38

Declaration [src]

GVariant*
g_variant_new_take_string (
  gchar* string
)

Description [src]

Creates a string GVariant with the contents of string.

string must be valid UTF-8, and must not be NULL. To encode potentially-NULL strings, use this with g_variant_new_maybe().

After this call, string belongs to the GVariant and may no longer be modified by the caller. The memory of data has to be dynamically allocated and will eventually be freed with g_free().

You must not modify or access string in any other way after passing it to this function. It is even possible that string is immediately freed.

Available since: 2.38

This function is not directly available to language bindings.

Parameters

string

Type: gchar*

A normal UTF-8 nul-terminated string.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: GVariant

A floating reference to a new string GVariant instance.

The data is owned by the called function.