• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- ##### SECTION Title ##### -->
2String Chunks
3
4<!-- ##### SECTION Short_Description ##### -->
5efficient storage of groups of strings
6
7<!-- ##### SECTION Long_Description ##### -->
8<para>
9String chunks are used to store groups of strings.
10Memory is allocated in blocks, and as strings are added to the #GStringChunk
11they are copied into the next free position in a block. When a block is
12full a new block is allocated.
13</para>
14<para>
15When storing a large number of strings, string chunks are more efficient
16than using g_strdup() since fewer calls to malloc() are needed, and less
17memory is wasted in memory allocation overheads.
18</para>
19<para>
20By adding strings with g_string_chunk_insert_const() it is also possible
21to remove duplicates.
22</para>
23<para>
24To create a new #GStringChunk use g_string_chunk_new().
25</para>
26<para>
27To add strings to a #GStringChunk use g_string_chunk_insert().
28</para>
29<para>
30To add strings to a #GStringChunk, but without duplicating strings which are
31already in the #GStringChunk, use g_string_chunk_insert_const().
32</para>
33<para>
34To free the entire #GStringChunk use g_string_chunk_free().
35It is not possible to free individual strings.
36</para>
37
38<!-- ##### SECTION See_Also ##### -->
39<para>
40
41</para>
42
43<!-- ##### SECTION Stability_Level ##### -->
44
45
46<!-- ##### STRUCT GStringChunk ##### -->
47<para>
48An opaque data structure representing String Chunks.
49It should only be accessed by using the following functions.
50</para>
51
52
53<!-- ##### FUNCTION g_string_chunk_new ##### -->
54<para>
55
56</para>
57
58@size:
59@Returns:
60
61
62<!-- ##### FUNCTION g_string_chunk_insert ##### -->
63<para>
64
65</para>
66
67@chunk:
68@string:
69@Returns:
70
71
72<!-- ##### FUNCTION g_string_chunk_insert_const ##### -->
73<para>
74
75</para>
76
77@chunk:
78@string:
79@Returns:
80
81
82<!-- ##### FUNCTION g_string_chunk_insert_len ##### -->
83<para>
84
85</para>
86
87@chunk:
88@string:
89@len:
90@Returns:
91
92
93<!-- ##### FUNCTION g_string_chunk_clear ##### -->
94<para>
95
96</para>
97
98@chunk:
99
100
101<!-- ##### FUNCTION g_string_chunk_free ##### -->
102<para>
103
104</para>
105
106@chunk:
107
108
109