# GLIB, Useful routines for C programming

## Version 1.0

## Feburary 1998

# Copying

# What is GLIB

# Doubly linked lists

### 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)

# Signly linked lists

### 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)

# List allocators

### 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)

# Hash tables

### 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)

# Cache handling

### 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)

# Tree handling

### 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)

# Memory handling

### 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).

# Timer functions

### 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)

# Output functions

### 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, ...)

# Utility functions

# Error handling

# String chunks

# String handling

# Resizable arrays

# Flexible lexical scanner

# Other stuff

# Function Index

## g

- g_blow_chunks
- g_cache_destroy
- g_cache_insert
- g_cache_key_foreach
- g_cache_new
- g_cache_remove
- g_cache_value_foreach
- g_error
- g_hash_table_destroy
- g_hash_table_foreach
- g_hash_table_freeze
- g_hash_table_insert
- g_hash_table_lookup
- g_hash_table_new
- g_hash_table_remove
- g_hash_table_thaw
- g_list_alloc
- g_list_allocator_free
- g_list_allocator_new
- g_list_append
- g_list_concat
- g_list_find
- g_list_first
- g_list_foreach
- g_list_free
- g_list_free_1
- g_list_insert
- g_list_insert_sorted
- g_list_last
- g_list_length
- g_list_nth
- g_list_prepend
- g_list_remove
- g_list_remove_link
- g_list_reverse
- g_list_set_allocator
- g_malloc
- g_malloc0
- g_mem_check
- g_mem_chunk_alloc
- g_mem_chunk_clean
- g_mem_chunk_destroy
- g_mem_chunk_free
- g_mem_chunk_info
- g_mem_chunk_new
- g_mem_chunk_print
- g_mem_chunk_reset
- g_mem_profile
- g_message
- g_print
- g_realloc
- g_slist_alloc
- g_slist_append
- g_slist_concat
- g_slist_find
- g_slist_foreach
- g_slist_free
- g_slist_free_1
- g_slist_insert
- g_slist_insert_sorted
- g_slist_last
- g_slist_length
- g_slist_nth
- g_slist_prepend
- g_slist_remove
- g_slist_remove_link
- g_slist_reverse
- g_slist_set_allocator
- g_timer_destroy
- g_timer_elapsed
- g_timer_new
- g_timer_reset
- g_timer_start
- g_timer_stop
- g_tree_destroy
- g_tree_height
- g_tree_lookup
- g_tree_new
- g_tree_nnodes
- g_tree_remove
- g_tree_search
- g_tree_traverse
- g_warning

# Concept Index

This document was generated on 24 Febuary 1999 using the texi2html translator version 1.54.