Deskbar

Overview

Htable

db_htable_new ()
db_htable_push ()
db_htable_pop ()
db_htable_destroy ()

List

db_list_new ()
db_list_insert ()
db_list_remove ()
db_list_foreach ()
db_list_find ()
db_list_destroy ()

Log

db_log_mesg ()
db_log_err ()
db_log_debug ()

Mem

db_mem_alloc ()
db_mem_free ()

String

db_string_hash ()
db_string_tolower ()
db_string_toupper ()

Time

db_time_local ()
db_time_current ()
db_time_delta ()
db_time_update_diff ()
db_time_update_time ()

Htable

#include <htable.h>

Hash tables provide an easy way to associate key - value pairs. A hash function genereates a hash value from the given key. Both the newly created hash and the address of the value are stored inside of the table.
Note: No data will be copied.


db_htable_new ()

Creates a new hash table.

Declaration:
DbHtable *db_htable_new (void)
Description:

This function allocates the space for a new hash table and returns the pointer to it or otherwise NULL on error.


db_htable_push ()

Inserts a new hash pair into the table.

Declaration:
void db_htable_push (DbHtable *table, void *key, void *value)
Description:

This function generates the hash value for the key and stores the hash and the given value in the table.

Arguments:

  1. table
  2. key
  3. value


db_htable_pop ()

Gets the appropriate value to a key from the table.

Declaration:
void *db_htable_pop (DbHtable *table, void *key)
Description:

This function returns the value to the given key or otherwise NULL if not found.


db_htable_pop ()

Destroys the table.

Declaration:
void *db_htable_destroy (DbHtable *table)
Description:

This function destroys the table and free's the allocated memory.


List

#include <list.h>

Hash tables provide an easy way to associate key - value pairs. A hash function genereates a hash value from the given key. Both the newly created hash and the address of the value are stored inside of the table.
Note: No data will be copied.


db_htable_new ()

Creates a new hash table.

Declaration:
DbHtable *db_htable_new (void)
Description:

This function allocates the space for a new hash table and returns the pointer to it or otherwise NULL on error.