mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Add a function for clearing a GStringChunk. (#364608, Matt Barnes)
2006-12-15 Matthias Clasen <mclasen@redhat.com> * glib/glib.symbols: * glib/gstring.[hc] (g_string_chunk_clear): Add a function for clearing a GStringChunk. (#364608, Matt Barnes)
This commit is contained in:
parent
eaec9bb86e
commit
0a3afe448b
@ -1,5 +1,9 @@
|
|||||||
2006-12-15 Matthias Clasen <mclasen@redhat.com>
|
2006-12-15 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/glib.symbols:
|
||||||
|
* glib/gstring.[hc] (g_string_chunk_clear): Add a function
|
||||||
|
for clearing a GStringChunk. (#364608, Matt Barnes)
|
||||||
|
|
||||||
* glib/guniprop.c (interval_compare): Avoid a compiler
|
* glib/guniprop.c (interval_compare): Avoid a compiler
|
||||||
warning.
|
warning.
|
||||||
|
|
||||||
|
@ -1078,6 +1078,7 @@ g_string_ascii_down
|
|||||||
g_string_ascii_up
|
g_string_ascii_up
|
||||||
g_string_assign
|
g_string_assign
|
||||||
g_string_chunk_free
|
g_string_chunk_free
|
||||||
|
g_string_chunk_clear
|
||||||
g_string_chunk_insert
|
g_string_chunk_insert
|
||||||
g_string_chunk_insert_const
|
g_string_chunk_insert_const
|
||||||
g_string_chunk_insert_len
|
g_string_chunk_insert_len
|
||||||
|
@ -162,6 +162,39 @@ g_string_chunk_free (GStringChunk *chunk)
|
|||||||
g_free (chunk);
|
g_free (chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_string_chunk_clear:
|
||||||
|
* @chunk: a #GStringChunk
|
||||||
|
*
|
||||||
|
* Frees all strings contained within the #GStringChunk.
|
||||||
|
* After calling g_string_chunk_clear() it is not safe to
|
||||||
|
* access any of the strings which were contained within it.
|
||||||
|
*
|
||||||
|
* Since: 2.14
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
g_string_chunk_clear (GStringChunk *chunk)
|
||||||
|
{
|
||||||
|
GSList *tmp_list;
|
||||||
|
|
||||||
|
g_return_if_fail (chunk != NULL);
|
||||||
|
|
||||||
|
if (chunk->storage_list)
|
||||||
|
{
|
||||||
|
for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next)
|
||||||
|
g_free (tmp_list->data);
|
||||||
|
|
||||||
|
g_slist_free (chunk->storage_list);
|
||||||
|
|
||||||
|
chunk->storage_list = NULL;
|
||||||
|
chunk->storage_next = chunk->default_size;
|
||||||
|
chunk->this_size = chunk->default_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chunk->const_table)
|
||||||
|
g_hash_table_remove_all (chunk->const_table);
|
||||||
|
}
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
g_string_chunk_insert (GStringChunk *chunk,
|
g_string_chunk_insert (GStringChunk *chunk,
|
||||||
const gchar *string)
|
const gchar *string)
|
||||||
|
@ -47,6 +47,7 @@ struct _GString
|
|||||||
*/
|
*/
|
||||||
GStringChunk* g_string_chunk_new (gsize size);
|
GStringChunk* g_string_chunk_new (gsize size);
|
||||||
void g_string_chunk_free (GStringChunk *chunk);
|
void g_string_chunk_free (GStringChunk *chunk);
|
||||||
|
void g_string_chunk_clear (GStringChunk *chunk);
|
||||||
gchar* g_string_chunk_insert (GStringChunk *chunk,
|
gchar* g_string_chunk_insert (GStringChunk *chunk,
|
||||||
const gchar *string);
|
const gchar *string);
|
||||||
gchar* g_string_chunk_insert_len (GStringChunk *chunk,
|
gchar* g_string_chunk_insert_len (GStringChunk *chunk,
|
||||||
|
Loading…
Reference in New Issue
Block a user