125
120
Contains the public fields of a pointer array.
126
121
</para><variablelist role="struct">
128
<term><link linkend="gpointer">gpointer</link> *<structfield>pdata</structfield>;</term>
123
<term><link linkend="gpointer">gpointer</link> *<structfield>pdata</structfield>;</term>
129
124
<listitem><simpara>points to the array of pointers, which may be moved when the array grows.
130
125
</simpara></listitem>
133
<term><link linkend="guint">guint</link> <structfield>len</structfield>;</term>
128
<term><link linkend="guint">guint</link> <structfield>len</structfield>;</term>
134
129
<listitem><simpara>number of pointers in the array.
136
130
</simpara></listitem>
138
132
</variablelist></refsect2>
140
<title><anchor id="g-ptr-array-new" role="function"/>g_ptr_array_new ()</title>
141
<indexterm><primary>g_ptr_array_new</primary></indexterm><programlisting><link linkend="GPtrArray">GPtrArray</link>* g_ptr_array_new (void);</programlisting>
133
<refsect2 id="g-ptr-array-new" role="function">
134
<title>g_ptr_array_new ()</title>
135
<indexterm zone="g-ptr-array-new"><primary sortas="g_ptr_array_new">g_ptr_array_new</primary></indexterm><programlisting><link linkend="GPtrArray">GPtrArray</link>* g_ptr_array_new (void);</programlisting>
143
137
Creates a new <link linkend="GPtrArray"><type>GPtrArray</type></link>.
144
138
</para><variablelist role="params">
145
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the new <link linkend="GPtrArray"><type>GPtrArray</type></link>.
139
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the new <link linkend="GPtrArray"><type>GPtrArray</type></link>.
148
140
</simpara></listitem></varlistentry>
149
141
</variablelist></refsect2>
151
<title><anchor id="g-ptr-array-sized-new" role="function"/>g_ptr_array_sized_new ()</title>
152
<indexterm><primary>g_ptr_array_sized_new</primary></indexterm><programlisting><link linkend="GPtrArray">GPtrArray</link>* g_ptr_array_sized_new (<link linkend="guint">guint</link> reserved_size);</programlisting>
142
<refsect2 id="g-ptr-array-sized-new" role="function">
143
<title>g_ptr_array_sized_new ()</title>
144
<indexterm zone="g-ptr-array-sized-new"><primary sortas="g_ptr_array_sized_new">g_ptr_array_sized_new</primary></indexterm><programlisting><link linkend="GPtrArray">GPtrArray</link>* g_ptr_array_sized_new (<link linkend="guint">guint</link> reserved_size);</programlisting>
154
146
Creates a new <link linkend="GPtrArray"><type>GPtrArray</type></link> with <parameter>reserved_size</parameter> pointers
155
147
preallocated. This avoids frequent reallocation, if you are going to
156
148
add many pointers to the array. Note however that the size of the
157
149
array is still 0.
158
150
</para><variablelist role="params">
159
<varlistentry><term><parameter>reserved_size</parameter> :</term>
151
<varlistentry><term><parameter>reserved_size</parameter> :</term>
160
152
<listitem><simpara>number of pointers preallocated.
161
153
</simpara></listitem></varlistentry>
162
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the new <link linkend="GPtrArray"><type>GPtrArray</type></link>.
154
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the new <link linkend="GPtrArray"><type>GPtrArray</type></link>.
165
155
</simpara></listitem></varlistentry>
166
156
</variablelist></refsect2>
168
<title><anchor id="g-ptr-array-add" role="function"/>g_ptr_array_add ()</title>
169
<indexterm><primary>g_ptr_array_add</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_add (<link linkend="GPtrArray">GPtrArray</link> *array,
157
<refsect2 id="g-ptr-array-add" role="function">
158
<title>g_ptr_array_add ()</title>
159
<indexterm zone="g-ptr-array-add"><primary sortas="g_ptr_array_add">g_ptr_array_add</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_add (<link linkend="GPtrArray">GPtrArray</link> *array,
170
160
<link linkend="gpointer">gpointer</link> data);</programlisting>
172
162
Adds a pointer to the end of the pointer array.
173
163
The array will grow in size automatically if necessary.
174
164
</para><variablelist role="params">
175
<varlistentry><term><parameter>array</parameter> :</term>
165
<varlistentry><term><parameter>array</parameter> :</term>
176
166
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
177
167
</simpara></listitem></varlistentry>
178
<varlistentry><term><parameter>data</parameter> :</term>
168
<varlistentry><term><parameter>data</parameter> :</term>
179
169
<listitem><simpara>the pointer to add.
182
170
</simpara></listitem></varlistentry>
183
171
</variablelist></refsect2>
185
<title><anchor id="g-ptr-array-remove" role="function"/>g_ptr_array_remove ()</title>
186
<indexterm><primary>g_ptr_array_remove</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g_ptr_array_remove (<link linkend="GPtrArray">GPtrArray</link> *array,
172
<refsect2 id="g-ptr-array-remove" role="function">
173
<title>g_ptr_array_remove ()</title>
174
<indexterm zone="g-ptr-array-remove"><primary sortas="g_ptr_array_remove">g_ptr_array_remove</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g_ptr_array_remove (<link linkend="GPtrArray">GPtrArray</link> *array,
187
175
<link linkend="gpointer">gpointer</link> data);</programlisting>
189
177
Removes the first occurrence of the given pointer from the pointer array.
190
178
The following elements are moved down one place.
193
It returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the pointer was removed, or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if the pointer
181
It returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the pointer was removed, or <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> if the pointer
195
183
</para><variablelist role="params">
196
<varlistentry><term><parameter>array</parameter> :</term>
184
<varlistentry><term><parameter>array</parameter> :</term>
197
185
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
198
186
</simpara></listitem></varlistentry>
199
<varlistentry><term><parameter>data</parameter> :</term>
187
<varlistentry><term><parameter>data</parameter> :</term>
200
188
<listitem><simpara>the pointer to remove.
201
189
</simpara></listitem></varlistentry>
202
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the pointer is removed. <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if the pointer is not found
190
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>%TRUE if the pointer is removed. <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> if the pointer is not found
206
192
</simpara></listitem></varlistentry>
207
193
</variablelist></refsect2>
209
<title><anchor id="g-ptr-array-remove-index" role="function"/>g_ptr_array_remove_index ()</title>
210
<indexterm><primary>g_ptr_array_remove_index</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_ptr_array_remove_index (<link linkend="GPtrArray">GPtrArray</link> *array,
194
<refsect2 id="g-ptr-array-remove-index" role="function">
195
<title>g_ptr_array_remove_index ()</title>
196
<indexterm zone="g-ptr-array-remove-index"><primary sortas="g_ptr_array_remove_index">g_ptr_array_remove_index</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_ptr_array_remove_index (<link linkend="GPtrArray">GPtrArray</link> *array,
211
197
<link linkend="guint">guint</link> index_);</programlisting>
213
199
Removes the pointer at the given index from the pointer array.
214
200
The following elements are moved down one place.
215
201
</para><variablelist role="params">
216
<varlistentry><term><parameter>array</parameter> :</term>
202
<varlistentry><term><parameter>array</parameter> :</term>
217
203
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
218
204
</simpara></listitem></varlistentry>
219
<varlistentry><term><parameter>index_</parameter> :</term>
205
<varlistentry><term><parameter>index_</parameter> :</term>
220
206
<listitem><simpara>the index of the pointer to remove.
221
207
</simpara></listitem></varlistentry>
222
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer which was removed.
208
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer which was removed.
225
209
</simpara></listitem></varlistentry>
226
210
</variablelist></refsect2>
228
<title><anchor id="g-ptr-array-remove-fast" role="function"/>g_ptr_array_remove_fast ()</title>
229
<indexterm><primary>g_ptr_array_remove_fast</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g_ptr_array_remove_fast (<link linkend="GPtrArray">GPtrArray</link> *array,
211
<refsect2 id="g-ptr-array-remove-fast" role="function">
212
<title>g_ptr_array_remove_fast ()</title>
213
<indexterm zone="g-ptr-array-remove-fast"><primary sortas="g_ptr_array_remove_fast">g_ptr_array_remove_fast</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g_ptr_array_remove_fast (<link linkend="GPtrArray">GPtrArray</link> *array,
230
214
<link linkend="gpointer">gpointer</link> data);</programlisting>
232
216
Removes the first occurrence of the given pointer from the pointer array.
235
219
<link linkend="g-ptr-array-remove"><function>g_ptr_array_remove()</function></link>.
238
It returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the pointer was removed, or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if the pointer
222
It returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the pointer was removed, or <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> if the pointer
240
224
</para><variablelist role="params">
241
<varlistentry><term><parameter>array</parameter> :</term>
225
<varlistentry><term><parameter>array</parameter> :</term>
242
226
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
243
227
</simpara></listitem></varlistentry>
244
<varlistentry><term><parameter>data</parameter> :</term>
228
<varlistentry><term><parameter>data</parameter> :</term>
245
229
<listitem><simpara>the pointer to remove.
246
230
</simpara></listitem></varlistentry>
247
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the pointer was found in the array.
231
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>%TRUE if the pointer was found in the array.
250
232
</simpara></listitem></varlistentry>
251
233
</variablelist></refsect2>
253
<title><anchor id="g-ptr-array-remove-index-fast" role="function"/>g_ptr_array_remove_index_fast ()</title>
254
<indexterm><primary>g_ptr_array_remove_index_fast</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_ptr_array_remove_index_fast (<link linkend="GPtrArray">GPtrArray</link> *array,
234
<refsect2 id="g-ptr-array-remove-index-fast" role="function">
235
<title>g_ptr_array_remove_index_fast ()</title>
236
<indexterm zone="g-ptr-array-remove-index-fast"><primary sortas="g_ptr_array_remove_index_fast">g_ptr_array_remove_index_fast</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_ptr_array_remove_index_fast (<link linkend="GPtrArray">GPtrArray</link> *array,
255
237
<link linkend="guint">guint</link> index_);</programlisting>
257
239
Removes the pointer at the given index from the pointer array.
259
241
does not preserve the order of the array. But it is faster than
260
242
<link linkend="g-ptr-array-remove-index"><function>g_ptr_array_remove_index()</function></link>.
261
243
</para><variablelist role="params">
262
<varlistentry><term><parameter>array</parameter> :</term>
244
<varlistentry><term><parameter>array</parameter> :</term>
263
245
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
264
246
</simpara></listitem></varlistentry>
265
<varlistentry><term><parameter>index_</parameter> :</term>
247
<varlistentry><term><parameter>index_</parameter> :</term>
266
248
<listitem><simpara>the index of the pointer to remove.
267
249
</simpara></listitem></varlistentry>
268
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer which was removed.
250
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer which was removed.
271
251
</simpara></listitem></varlistentry>
272
252
</variablelist></refsect2>
274
<title><anchor id="g-ptr-array-remove-range" role="function" condition="since:2.4"/>g_ptr_array_remove_range ()</title>
275
<indexterm role="2.4"><primary>g_ptr_array_remove_range</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_remove_range (<link linkend="GPtrArray">GPtrArray</link> *array,
253
<refsect2 id="g-ptr-array-remove-range" role="function" condition="since:2.4">
254
<title>g_ptr_array_remove_range ()</title>
255
<indexterm zone="g-ptr-array-remove-range" role="2.4"><primary sortas="g_ptr_array_remove_range">g_ptr_array_remove_range</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_remove_range (<link linkend="GPtrArray">GPtrArray</link> *array,
276
256
<link linkend="guint">guint</link> index_,
277
257
<link linkend="guint">guint</link> length);</programlisting>
279
259
Removes the given number of pointers starting at the given index from a
280
260
<link linkend="GPtrArray"><type>GPtrArray</type></link>. The following elements are moved to close the gap.
281
261
</para><variablelist role="params">
282
<varlistentry><term><parameter>array</parameter> :</term>
262
<varlistentry><term><parameter>array</parameter> :</term>
283
263
<listitem><simpara>a <parameter>GPtrArray</parameter>.
284
264
</simpara></listitem></varlistentry>
285
<varlistentry><term><parameter>index_</parameter> :</term>
265
<varlistentry><term><parameter>index_</parameter> :</term>
286
266
<listitem><simpara>the index of the first pointer to remove.
287
267
</simpara></listitem></varlistentry>
288
<varlistentry><term><parameter>length</parameter> :</term>
268
<varlistentry><term><parameter>length</parameter> :</term>
289
269
<listitem><simpara>the number of pointers to remove.
290
270
</simpara></listitem></varlistentry>
291
</variablelist><para role="since">Since 2.4
296
<title><anchor id="g-ptr-array-sort" role="function"/>g_ptr_array_sort ()</title>
297
<indexterm><primary>g_ptr_array_sort</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_sort (<link linkend="GPtrArray">GPtrArray</link> *array,
271
</variablelist><para role="since">Since 2.4</para></refsect2>
272
<refsect2 id="g-ptr-array-sort" role="function">
273
<title>g_ptr_array_sort ()</title>
274
<indexterm zone="g-ptr-array-sort"><primary sortas="g_ptr_array_sort">g_ptr_array_sort</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_sort (<link linkend="GPtrArray">GPtrArray</link> *array,
298
275
<link linkend="GCompareFunc">GCompareFunc</link> compare_func);</programlisting>
300
277
Sorts the array, using <parameter>compare_func</parameter> which should be a <link linkend="qsort"><function>qsort()</function></link>-style comparison
301
function (returns less than zero for first arg is less than second arg,
278
function (returns less than zero for first arg is less than second arg,
302
279
zero for equal, greater than zero if irst arg is greater than second arg).
309
The comparison function for <link linkend="g-ptr-array-sort"><function>g_ptr_array_sort()</function></link> doesn't take the pointers
286
The comparison function for <link linkend="g-ptr-array-sort"><function>g_ptr_array_sort()</function></link> doesn't take the pointers
310
287
from the array as arguments, it takes pointers to the pointers in the array.
311
288
</para></note><variablelist role="params">
312
<varlistentry><term><parameter>array</parameter> :</term>
289
<varlistentry><term><parameter>array</parameter> :</term>
313
290
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
314
291
</simpara></listitem></varlistentry>
315
<varlistentry><term><parameter>compare_func</parameter> :</term>
292
<varlistentry><term><parameter>compare_func</parameter> :</term>
316
293
<listitem><simpara>comparison function.
319
294
</simpara></listitem></varlistentry>
320
295
</variablelist></refsect2>
322
<title><anchor id="g-ptr-array-sort-with-data" role="function"/>g_ptr_array_sort_with_data ()</title>
323
<indexterm><primary>g_ptr_array_sort_with_data</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_sort_with_data (<link linkend="GPtrArray">GPtrArray</link> *array,
296
<refsect2 id="g-ptr-array-sort-with-data" role="function">
297
<title>g_ptr_array_sort_with_data ()</title>
298
<indexterm zone="g-ptr-array-sort-with-data"><primary sortas="g_ptr_array_sort_with_data">g_ptr_array_sort_with_data</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_sort_with_data (<link linkend="GPtrArray">GPtrArray</link> *array,
324
299
<link linkend="GCompareDataFunc">GCompareDataFunc</link> compare_func,
325
300
<link linkend="gpointer">gpointer</link> user_data);</programlisting>
327
Like <link linkend="g-ptr-array-sort"><function>g_ptr_array_sort()</function></link>, but the comparison function has an extra user data
302
Like <link linkend="g-ptr-array-sort"><function>g_ptr_array_sort()</function></link>, but the comparison function has an extra user data
331
The comparison function for <link linkend="g-ptr-array-sort-with-data"><function>g_ptr_array_sort_with_data()</function></link> doesn't take the
332
pointers from the array as arguments, it takes pointers to the pointers in
306
The comparison function for <link linkend="g-ptr-array-sort-with-data"><function>g_ptr_array_sort_with_data()</function></link> doesn't take the
307
pointers from the array as arguments, it takes pointers to the pointers in
334
309
</para></note><variablelist role="params">
335
<varlistentry><term><parameter>array</parameter> :</term>
310
<varlistentry><term><parameter>array</parameter> :</term>
336
311
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
337
312
</simpara></listitem></varlistentry>
338
<varlistentry><term><parameter>compare_func</parameter> :</term>
313
<varlistentry><term><parameter>compare_func</parameter> :</term>
339
314
<listitem><simpara>comparison function.
340
315
</simpara></listitem></varlistentry>
341
<varlistentry><term><parameter>user_data</parameter> :</term>
316
<varlistentry><term><parameter>user_data</parameter> :</term>
342
317
<listitem><simpara>data to pass to <parameter>compare_func</parameter>.
345
318
</simpara></listitem></varlistentry>
346
319
</variablelist></refsect2>
348
<title><anchor id="g-ptr-array-set-size" role="function"/>g_ptr_array_set_size ()</title>
349
<indexterm><primary>g_ptr_array_set_size</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_set_size (<link linkend="GPtrArray">GPtrArray</link> *array,
320
<refsect2 id="g-ptr-array-set-size" role="function">
321
<title>g_ptr_array_set_size ()</title>
322
<indexterm zone="g-ptr-array-set-size"><primary sortas="g_ptr_array_set_size">g_ptr_array_set_size</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_set_size (<link linkend="GPtrArray">GPtrArray</link> *array,
350
323
<link linkend="gint">gint</link> length);</programlisting>
352
325
Sets the size of the array, expanding it if necessary.
353
New elements are set to <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
326
New elements are set to <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
354
327
</para><variablelist role="params">
355
<varlistentry><term><parameter>array</parameter> :</term>
328
<varlistentry><term><parameter>array</parameter> :</term>
356
329
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
357
330
</simpara></listitem></varlistentry>
358
<varlistentry><term><parameter>length</parameter> :</term>
331
<varlistentry><term><parameter>length</parameter> :</term>
359
332
<listitem><simpara>the new length of the pointer array.
362
333
</simpara></listitem></varlistentry>
363
334
</variablelist></refsect2>
365
<title><anchor id="g-ptr-array-index" role="macro"/>g_ptr_array_index()</title>
366
<indexterm><primary>g_ptr_array_index</primary></indexterm><programlisting>#define g_ptr_array_index(array,index_)</programlisting>
335
<refsect2 id="g-ptr-array-index" role="macro">
336
<title>g_ptr_array_index()</title>
337
<indexterm zone="g-ptr-array-index"><primary sortas="g_ptr_array_index">g_ptr_array_index</primary></indexterm><programlisting>#define g_ptr_array_index(array,index_)</programlisting>
368
339
Returns the pointer at the given index of the pointer array.
369
340
</para><variablelist role="params">
370
<varlistentry><term><parameter>array</parameter> :</term>
341
<varlistentry><term><parameter>array</parameter> :</term>
371
342
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
372
343
</simpara></listitem></varlistentry>
373
<varlistentry><term><parameter>index_</parameter> :</term>
344
<varlistentry><term><parameter>index_</parameter> :</term>
374
345
<listitem><simpara>the index of the pointer to return.
375
346
</simpara></listitem></varlistentry>
376
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer at the given index.
347
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer at the given index.
379
348
</simpara></listitem></varlistentry>
380
349
</variablelist></refsect2>
382
<title><anchor id="g-ptr-array-free" role="function"/>g_ptr_array_free ()</title>
383
<indexterm><primary>g_ptr_array_free</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>* g_ptr_array_free (<link linkend="GPtrArray">GPtrArray</link> *array,
350
<refsect2 id="g-ptr-array-free" role="function">
351
<title>g_ptr_array_free ()</title>
352
<indexterm zone="g-ptr-array-free"><primary sortas="g_ptr_array_free">g_ptr_array_free</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>* g_ptr_array_free (<link linkend="GPtrArray">GPtrArray</link> *array,
384
353
<link linkend="gboolean">gboolean</link> free_seg);</programlisting>
386
355
Frees the memory allocated for the <link linkend="GPtrArray"><type>GPtrArray</type></link>.
387
If <parameter>free_segment</parameter> is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> it frees the memory block holding the elements
388
as well. Pass <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if you want to free the <link linkend="GPtrArray"><type>GPtrArray</type></link> wrapper but preserve
356
If <parameter>free_segment</parameter> is <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> it frees the memory block holding the elements
357
as well. Pass <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> if you want to free the <link linkend="GPtrArray"><type>GPtrArray</type></link> wrapper but preserve
389
358
the underlying array for use elsewhere.
396
365
</note><variablelist role="params">
397
<varlistentry><term><parameter>array</parameter> :</term>
366
<varlistentry><term><parameter>array</parameter> :</term>
398
367
<listitem><simpara>a <link linkend="GPtrArray"><type>GPtrArray</type></link>.
399
368
</simpara></listitem></varlistentry>
400
<varlistentry><term><parameter>free_seg</parameter> :</term>
401
<listitem><simpara>if <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> the actual pointer array is freed as well.
369
<varlistentry><term><parameter>free_seg</parameter> :</term>
370
<listitem><simpara>if <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> the actual pointer array is freed as well.
402
371
</simpara></listitem></varlistentry>
403
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer array if <parameter>free_seg</parameter> is <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>, otherwise <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
372
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>the pointer array if <parameter>free_seg</parameter> is <link linkend="FALSE--CAPS"><literal>FALSE</literal></link>, otherwise <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
404
373
The pointer array should be freed using <link linkend="g-free"><function>g_free()</function></link>.
407
374
</simpara></listitem></varlistentry>
408
375
</variablelist></refsect2>
410
<title><anchor id="g-ptr-array-foreach" role="function" condition="since:2.4"/>g_ptr_array_foreach ()</title>
411
<indexterm role="2.4"><primary>g_ptr_array_foreach</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_foreach (<link linkend="GPtrArray">GPtrArray</link> *array,
376
<refsect2 id="g-ptr-array-foreach" role="function" condition="since:2.4">
377
<title>g_ptr_array_foreach ()</title>
378
<indexterm zone="g-ptr-array-foreach" role="2.4"><primary sortas="g_ptr_array_foreach">g_ptr_array_foreach</primary></indexterm><programlisting><link linkend="void">void</link> g_ptr_array_foreach (<link linkend="GPtrArray">GPtrArray</link> *array,
412
379
<link linkend="GFunc">GFunc</link> func,
413
380
<link linkend="gpointer">gpointer</link> user_data);</programlisting>
415
382
Calls a function for each element of a <link linkend="GPtrArray"><type>GPtrArray</type></link>.</para>
418
384
</para><variablelist role="params">
419
<varlistentry><term><parameter>array</parameter> :</term>
385
<varlistentry><term><parameter>array</parameter> :</term>
420
386
<listitem><simpara> a <link linkend="GPtrArray"><type>GPtrArray</type></link>
421
387
</simpara></listitem></varlistentry>
422
<varlistentry><term><parameter>func</parameter> :</term>
388
<varlistentry><term><parameter>func</parameter> :</term>
423
389
<listitem><simpara> the function to call for each array element
424
390
</simpara></listitem></varlistentry>
425
<varlistentry><term><parameter>user_data</parameter> :</term>
391
<varlistentry><term><parameter>user_data</parameter> :</term>
426
392
<listitem><simpara> user data to pass to the function
427
393
</simpara></listitem></varlistentry>
428
</variablelist><para role="since">Since 2.4
394
</variablelist><para role="since">Since 2.4</para></refsect2>
437
<refsect1><refsect2 /><refsect2 /></refsect1>