My Kernel v0.1.0
Hash table
Collaboration diagram for Hash table:

Data Structures

struct  hashtable_entry
 Structure used to store entries inside an hashtable. More...
 

Macros

#define DECLARE_HASHTABLE(name, size)
 Declare a hashtable structure.
 
#define hashtable_init(hashtable)    __hashtable_init(&(hashtable)->table, ARRAY_SIZE((hashtable)->buckets))
 Initialize an empty hashtable. More...
 
#define hashtable_insert(hashtable, entry)    __hashtable_insert(&(hashtable)->table, entry)
 Add an entry into an hashtable. More...
 
#define hashtable_remove(hashtable, key)    __hashtable_remove(&(hashtable)->table, key)
 Remove an entry from an hashtable. More...
 
#define hashtable_find(hashtable, key)    __hashtable_find(&(hashtable)->table, key)
 Find an entry inside an hastable. More...
 

Detailed Description

Hash table

This is our implementation for hash tables.

Key

This implementation only supports pointers for keys. The user should make sure that all keys are unique since this is not verified by this library.

Macro Definition Documentation

◆ hashtable_find

#define hashtable_find (   hashtable,
  key 
)     __hashtable_find(&(hashtable)->table, key)
Parameters
hashtableThe hashtable union declared using DECLARE_HASHTABLE().
entryKey used to find the entry.
Returns
The entry, or NULL if it did not exist.

◆ hashtable_init

#define hashtable_init (   hashtable)     __hashtable_init(&(hashtable)->table, ARRAY_SIZE((hashtable)->buckets))
Parameters
hashtableThe hashtable union declared using DECLARE_HASHTABLE().

◆ hashtable_insert

#define hashtable_insert (   hashtable,
  entry 
)     __hashtable_insert(&(hashtable)->table, entry)
Parameters
hashtableThe hashtable union declared using DECLARE_HASHTABLE().
entryPointer to the hashtable entry to add.

◆ hashtable_remove

#define hashtable_remove (   hashtable,
  key 
)     __hashtable_remove(&(hashtable)->table, key)
Parameters
hashtableThe hashtable union declared using DECLARE_HASHTABLE().
entryKey used to find the entry to remove.
Returns
The removed entry, or NULL if it did not exist.