Function

GLibVariantnew_take_string

Declaration

GVariant*
g_variant_new_take_string (
  gchar* string
)

Description

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().

This function consumes string. g_free() will be called on string when it is no longer required.

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

Parameters

string gchar*
 

A normal UTF-8 nul-terminated string.

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

Return value

Returns: GVariant
 

A floating reference to a new string GVariant instance.

 The data is owned by the called function.