mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-16 16:24:13 +00:00
change hash to use flags per entry for free on keys and values
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@566 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
1 parent
a3922ed7c8
commit
8811a8d02e
4 files changed
+23
-12
No files matched your search
@@ -101,8 +101,15 @@ create_hashtable(unsigned int minsize,
|
||||
* If in doubt, remove before insert.
|
||||
*/
|
||||
|
||||
|
||||
typedef enum {
|
||||
HASHTABLE_FLAG_NONE = 0,
|
||||
HASHTABLE_FLAG_FREE_KEY = (1 << 0),
|
||||
HASHTABLE_FLAG_FREE_VALUE = (1 << 1)
|
||||
} hashtable_flag_t;
|
||||
|
||||
int
|
||||
hashtable_insert(struct hashtable *h, void *k, void *v);
|
||||
hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags);
|
||||
|
||||
#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
|
||||
int fnname (struct hashtable *h, keytype *k, valuetype *v) \
|
||||
@@ -167,7 +174,7 @@ hashtable_count(struct hashtable *h);
|
||||
*/
|
||||
|
||||
void
|
||||
hashtable_destroy(struct hashtable *h, int free_keys, int free_values);
|
||||
hashtable_destroy(struct hashtable *h);
|
||||
|
||||
struct hashtable_iterator *hashtable_first(struct hashtable *h);
|
||||
struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i);
|
||||
|
||||
@@ -12,6 +12,7 @@ struct entry
|
||||
{
|
||||
void *k, *v;
|
||||
unsigned int h;
|
||||
hashtable_flag_t flags;
|
||||
struct entry *next;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user