projects
/
cgds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some fixes + improvements (Vector) + code reformatting
[cgds.git]
/
src
/
HashTable.h
diff --git
a/src/HashTable.h
b/src/HashTable.h
index
2d5659f
..
9ed3755
100644
(file)
--- a/
src/HashTable.h
+++ b/
src/HashTable.h
@@
-9,7
+9,6
@@
#include <string.h>
#include "cgds/safe_alloc.h"
#include "cgds/types.h"
#include <string.h>
#include "cgds/safe_alloc.h"
#include "cgds/types.h"
-#include "cgds/Vector.h"
/**
* @brief Cell of a dictionary.
/**
* @brief Cell of a dictionary.
@@
-54,9
+53,7
@@
HashTable* _hashtable_new(
* Usage: HashTable* hashtable_new(<Type> type, UInt hash_size)
*/
#define hashtable_new(type, hsize) \
* Usage: HashTable* hashtable_new(<Type> 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).
/**
* @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..
* @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) \
{ \
*/
#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) \
{ \
*/
#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).
_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.
*/
void hashtable_delete(
HashTable* hashTable, ///< "this" pointer.