Function

GLibset_strv_take

unstable since: 2.90

Declaration [src]

static inline gboolean
g_set_strv_take (
  char*** strv_pointer,
  char** new_strv
)

Description [src]

Safely replaces a string vector, taking ownership of the new value.

Updates a pointer to a NULL-terminated string array to new_strv and returns whether the value was changed.

If new_strv contains the same strings as the previous array, this function is a no-op. If new_strv is different, it will be assigned to strv_pointer and the previous array pointed to by strv_pointer will be freed with g_strfreev().

If new_strv does not replace the existing value, it will be freed with g_strfreev(), unless it is NULL.

The contents of both string arrays are compared for equality before replacing the value. In the worst case this requires O(N) time.

strv_pointer must not be NULL, but can point to a NULL value. new_strv must be NULL or a string array not already stored in strv_pointer.

Available since: 2.90

This function is not directly available to language bindings.

Parameters

strv_pointer

Type: char***

A pointer to either a NULL-terminated string array or NULL.

The argument will be modified by the function.
The caller of the function takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.
new_strv

Type: char**

A NULL-terminated string array to assign to strv_pointer.

The argument can be NULL.
The called function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.

Return value

Type: gboolean

True if the value of strv_pointer changed, false otherwise.