diff --git a/docs/reference/glib/tmpl/.gitignore b/docs/reference/glib/tmpl/.gitignore index dcaa60261..dce5b296b 100644 --- a/docs/reference/glib/tmpl/.gitignore +++ b/docs/reference/glib/tmpl/.gitignore @@ -9,5 +9,6 @@ option.sgml random_numbers.sgml sequence.sgml shell.sgml +string_chunks.sgml threads.sgml timers.sgml diff --git a/docs/reference/glib/tmpl/string_chunks.sgml b/docs/reference/glib/tmpl/string_chunks.sgml deleted file mode 100644 index 12b3a53a0..000000000 --- a/docs/reference/glib/tmpl/string_chunks.sgml +++ /dev/null @@ -1,108 +0,0 @@ - -String Chunks - - -efficient storage of groups of strings - - - -String chunks are used to store groups of strings. -Memory is allocated in blocks, and as strings are added to the #GStringChunk -they are copied into the next free position in a block. When a block is -full a new block is allocated. - - -When storing a large number of strings, string chunks are more efficient -than using g_strdup() since fewer calls to malloc() are needed, and less -memory is wasted in memory allocation overheads. - - -By adding strings with g_string_chunk_insert_const() it is also possible -to remove duplicates. - - -To create a new #GStringChunk use g_string_chunk_new(). - - -To add strings to a #GStringChunk use g_string_chunk_insert(). - - -To add strings to a #GStringChunk, but without duplicating strings which are -already in the #GStringChunk, use g_string_chunk_insert_const(). - - -To free the entire #GStringChunk use g_string_chunk_free(). -It is not possible to free individual strings. - - - - - - - - - - - - -An opaque data structure representing String Chunks. -It should only be accessed by using the following functions. - - - - - - - - -@size: -@Returns: - - - - - - - -@chunk: -@string: -@Returns: - - - - - - - -@chunk: -@string: -@Returns: - - - - - - - -@chunk: -@string: -@len: -@Returns: - - - - - - - -@chunk: - - - - - - - -@chunk: - - diff --git a/glib/gstring.c b/glib/gstring.c index dcd9ffb13..aaff031c0 100644 --- a/glib/gstring.c +++ b/glib/gstring.c @@ -44,6 +44,41 @@ #include "galias.h" +/** + * SECTION: string_chunks + * @title: String Chunks + * @short_description: efficient storage of groups of strings + * + * String chunks are used to store groups of strings. Memory is + * allocated in blocks, and as strings are added to the #GStringChunk + * they are copied into the next free position in a block. When a block + * is full a new block is allocated. + * + * When storing a large number of strings, string chunks are more + * efficient than using g_strdup() since fewer calls to malloc() are + * needed, and less memory is wasted in memory allocation overheads. + * + * By adding strings with g_string_chunk_insert_const() it is also + * possible to remove duplicates. + * + * To create a new #GStringChunk use g_string_chunk_new(). + * + * To add strings to a #GStringChunk use g_string_chunk_insert(). + * + * To add strings to a #GStringChunk, but without duplicating strings + * which are already in the #GStringChunk, use + * g_string_chunk_insert_const(). + * + * To free the entire #GStringChunk use g_string_chunk_free(). It is + * not possible to free individual strings. + **/ + +/** + * GStringChunk: + * + * An opaque data structure representing String Chunks. It should only + * be accessed by using the following functions. + **/ struct _GStringChunk { GHashTable *const_table;