useful routines for ’C’ programming
1. Copying
2. What is GLIB
3. Doubly linked lists
3.1 Functions
- Function: GList* g_list_alloc (void)
- Function: void g_list_free (GList *list)
- Function: void g_list_free_1 (GList *list)
- Function: GList* g_list_append (GList *list, gpointer data)
- Function: GList* g_list_prepend (GList *list, gpointer data)
- Function: GList* g_list_insert (GList *list, gpointer data, gint position)
- Function: GList* g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
- Function: GList* g_list_concat (GList *list1, GList *list2)
- Function: GList* g_list_remove (GList *list, gpointer data)
- Function: GList* g_list_remove_link (GList *list, GList *link)
- Function: GList* g_list_reverse (GList *list)
- Function: GList* g_list_nth (GList *list, gint n)
- Function: GList* g_list_find (GList *list, gpointer data)
- Function: GList* g_list_last (GList *list)
- Function: GList* g_list_first (GList *list)
- Function: gint g_list_length (GList *list)
- Function: void g_list_foreach (GList *list, GFunc func, gpointer user_data)
4. Signly linked lists
4.1 Functions
- Function: GSList* g_slist_alloc (void)
- Function: void g_slist_free (GSList *list)
- Function: void g_slist_free_1 (GSList *list)
- Function: GSList* g_slist_append (GSList *list, gpointer data)
- Function: GSList* g_slist_prepend (GSList *list, gpointer data)
- Function: GSList* g_slist_insert (GSList *list, gpointer data, gint position)
- Function: GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
- Function: GSList* g_slist_concat (GSList *list1, GSList *list2)
- Function: GSList* g_slist_remove (GSList *list, gpointer data)
- Function: GSList* g_slist_remove_link (GSList *list, GSList *link)
- Function: GSList* g_slist_reverse (GSList *list)
- Function: GSList* g_slist_nth (GSList *list, gint n)
- Function: GSList* g_slist_find (GSList *list, gpointer data)
- Function: GSList* g_slist_last (GSList *list)
- Function: gint g_slist_length (GSList *list)
- Function: void g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
5. List allocators
5.1 Functions
- Function: GListAllocator* g_list_allocator_new (void)
- Function: void g_list_allocator_free (GListAllocator *allocator)
- Function: GListAllocator* g_slist_set_allocator (GListAllocator *allocator)
- Function: GListAllocator* g_list_set_allocator (GListAllocator *allocator)
6. Hash tables
6.1 Functions
- Function: GHashTable* g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func)
- Function: void g_hash_table_destroy (GHashTable *hash_table)
- Function: void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value)
- Function: void g_hash_table_remove (GHashTable *hash_table, gpointer key)
- Function: gpointer g_hash_table_lookup (GHashTable *hash_table, gpointer key)
- Function: void g_hash_table_freeze (GHashTable *hash_table)
- Function: void g_hash_table_thaw (GHashTable *hash_table)
- Function: void g_hash_table_foreach (GHashTable *hash_table, GHFunc func, gpointer user_data)
7. Cache handling
7.1 Functions
- Function: GCache* g_cache_new (GCacheNewFunc value_new_func, GCacheDestroyFunc value_destroy_func, GCacheDupFunc key_dup_func, GCacheDestroyFunc key_destroy_func, GHashFunc hash_key_func, GHashFunc hash_value_func, GCompareFunc key_compare_func)
- Function: void g_cache_destroy (GCache *cache)
- Function: gpointer g_cache_insert (GCache *cache, gpointer key)
- Function: void g_cache_remove (GCache *cache, gpointer key)
- Function: void g_cache_key_foreach (GCache *cache, GHFunc func, gpointer user_data)
- Function: void g_cache_value_foreach (GCache *cache, GHFunc func, gpointer user_data)
8. Tree handling
8.1 Functions
- Function: GTree* g_tree_new (GCompareFunc key_compare_func)
- Function: void g_tree_destroy (GTree *tree)
- Function: void g_tree_remove (GTree *tree, gpointer key, gpointer value)
- Function: gpointer g_tree_lookup (GTree *tree, gpointer key)
- Function: void g_tree_traverse (GTree *tree, GTraverseFunc traverse_func, GTraverseType traverse_type, gpointer data
- Function: gpointer g_tree_search (GTree *tree, GSearchFunc search_func, gpointer data)
- Function: gint g_tree_height (GTree *tree)
- Function: gint g_tree_nnodes (GTree *tree)
9. Memory handling
9.1 Functions
- Function: gpointer g_malloc (gulong size)
- Function: gpointer g_malloc0 (gulong size)
- Function: gpointer g_realloc (gpointer mem, gulong size)
- Function: void g_mem_profile (void)
- Function: void g_mem_check (gpointer mem)
- Function: GMemChunk* g_mem_chunk_new (gchar *name, gint atom_size, gulong area_size, gint type)
- Function: void g_mem_chunk_destroy (GMemChunk *mem_chunk)
- Function: gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk)
- Function: void g_mem_chunk_free (GMemChunk *mem_chunk, gpointer mem)
- Function: void g_mem_chunk_clean (GMemChunk *mem_chunk)
- Function: void g_mem_chunk_reset (GMemChunk *mem_chunk)
- Function: void g_mem_chunk_print (GMemChunk *mem_chunk)
- Function: void g_mem_chunk_info (void)
- Function: void g_blow_chunks (void)
Not what you might be thinking, g_blow_chunks()
simply compresses all
the chunks. This operation consists of freeing every memory area that should
be freed (but which we haven’t gotten around to doing yet).
10. Timer functions
10.1 Functions
- Function: GTimer* g_timer_new (void)
- Function: void g_timer_destroy (GTimer *timer)
- Function: void g_timer_start (GTimer *timer)
- Function: void g_timer_stop (GTimer *timer)
- Function: void g_timer_reset (GTimer *timer)
- Function: gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds)
11. Output functions
11.1 Functions
- Function: void g_error (gchar *format, …)
- Function: void g_warning (gchar *format, …)
- Function: void g_message (gchar *format, …)
- Function: void g_print (gchar *format, …)
12. Utility functions
13. Error handling
14. String chunks
15. String handling
16. Resizable arrays
17. Flexible lexical scanner
18. Other stuff
Function Index
Concept Index
Table of Contents
Short Table of Contents
About This Document
This document was generated on December 18, 2024 using texi2html 1.82.
The buttons in the navigation panels have the following meaning:
Button |
Name |
Go to |
From 1.2.3 go to |
[ < ] |
Back |
Previous section in reading order |
1.2.2 |
[ > ] |
Forward |
Next section in reading order |
1.2.4 |
[ << ] |
FastBack |
Beginning of this chapter or previous chapter |
1 |
[ Up ] |
Up |
Up section |
1.2 |
[ >> ] |
FastForward |
Next chapter |
2 |
[Top] |
Top |
Cover (top) of document |
|
[Contents] |
Contents |
Table of contents |
|
[Index] |
Index |
Index |
|
[ ? ] |
About |
About (help) |
|
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
- 1. Section One
- 1.1 Subsection One-One
- 1.2 Subsection One-Two
- 1.2.1 Subsubsection One-Two-One
- 1.2.2 Subsubsection One-Two-Two
- 1.2.3 Subsubsection One-Two-Three
<== Current Position
- 1.2.4 Subsubsection One-Two-Four
- 1.3 Subsection One-Three
- 1.4 Subsection One-Four
This document was generated on December 18, 2024 using texi2html 1.82.