X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=src%2FHashTable.h;h=9ed375519443aad00f6ea4ef415753e94d13e3bc;hb=588a2232cf24183218d88c85003f2e6093f942ed;hp=2d5659f158a17441aa503b92f5eaa306762f1afb;hpb=e45132acdb58c076d5e06849fa51c26de9a7486d;p=cgds.git diff --git a/src/HashTable.h b/src/HashTable.h index 2d5659f..9ed3755 100644 --- a/src/HashTable.h +++ b/src/HashTable.h @@ -9,7 +9,6 @@ #include #include "cgds/safe_alloc.h" #include "cgds/types.h" -#include "cgds/Vector.h" /** * @brief Cell of a dictionary. @@ -54,9 +53,7 @@ HashTable* _hashtable_new( * Usage: HashTable* hashtable_new( type, UInt hash_size) */ #define hashtable_new(type, hsize) \ -{ \ - _hashtable_new(sizeof(type), hsize); \ -} + _hashtable_new(sizeof(type), hsize) /** * @brief Copy constructor (shallow copy, ok for basic types). @@ -91,14 +88,13 @@ void* _hashtable_get( * @brief Lookup element of given key. * @param hashTable "this" pointer. * @param key Key of the element to retrieve.. - * @param data 'out' variable to contain the result. + * @param data 'out' variable (ptr) to contain the result. * - * Usage: void hashtable_get(HashTable* hashTable, char* key, void data) + * Usage: void hashtable_get(HashTable* hashTable, char* key, void* data) */ #define hashtable_get(hashTable, key, data) \ { \ - void* pData = _hashtable_get(hashTable, key); \ - data = *((typeof(&data))pData); \ + data = (typeof(data))_hashtable_get(hashTable, key); \ } /** @@ -120,12 +116,14 @@ void _hashtable_set( */ #define hashtable_set(hashTable, key, data) \ { \ - typeof((data)) tmp = data; \ + typeof(data) tmp = data; \ _hashtable_set(hashTable, key, &tmp); \ } /** * @brief Remove the given key (+ associated value). + * + * Usage: void hashtable_delete(HashTable* hashTable, char* key) */ void hashtable_delete( HashTable* hashTable, ///< "this" pointer.