Method

GLibStringChunkinsert_const

Declaration

gchar*
g_string_chunk_insert_const (
  GStringChunk* chunk,
  const gchar* string
)

Description

Adds a copy of string to the GStringChunk, unless the same string has already been added to the GStringChunk with g_string_chunk_insert_const().

This function is useful if you need to copy a large number of strings but do not want to waste space storing duplicates. But you must remember that there may be several pointers to the same string, and so any changes made to the strings should be done very carefully.

Note that g_string_chunk_insert_const() will not return a pointer to a string added with g_string_chunk_insert(), even if they do match.

Parameters

string

Type: const gchar*

The string to add.

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

Return value

Type: gchar*

A pointer to the new or existing copy of string within the GStringChunk.

The caller of the method takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.