summaryrefslogtreecommitdiff
path: root/src/hashtable.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-02-27 22:30:28 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-03 20:23:50 +0200
commit2e60b652908a268a4333a6661e0fb95ccaeec1bc (patch)
treee8a03f0c1835d959b857454e6386da146a5f582f /src/hashtable.h
parentccef1c9dc22b07398970f26eb9fd3be669db7734 (diff)
downloadlibgit2-2e60b652908a268a4333a6661e0fb95ccaeec1bc.tar.gz
Add extra methods to the new Hashtable implementation
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/hashtable.h')
-rw-r--r--src/hashtable.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/hashtable.h b/src/hashtable.h
index 74da580ef..c3475b6ed 100644
--- a/src/hashtable.h
+++ b/src/hashtable.h
@@ -34,11 +34,19 @@ typedef struct git_hashtable git_hashtable;
git_hashtable *git_hashtable_alloc(size_t min_size,
git_hash_ptr hash,
git_hash_keyeq_ptr key_eq);
-int git_hashtable_insert(git_hashtable *h, const void *key, void *value);
void *git_hashtable_lookup(git_hashtable *h, const void *key);
int git_hashtable_remove(git_hashtable *table, const void *key);
void git_hashtable_free(git_hashtable *h);
void git_hashtable_clear(git_hashtable *h);
+int git_hashtable_merge(git_hashtable *self, git_hashtable *other);
+
+int git_hashtable_insert2(git_hashtable *h, const void *key, void *value, void **old_value);
+
+GIT_INLINE(int) git_hashtable_insert(git_hashtable *h, const void *key, void *value)
+{
+ void *_unused;
+ return git_hashtable_insert2(h, key, value, &_unused);
+}
#define git_hashtable_node_at(nodes, pos) ((git_hashtable_node *)(&nodes[pos]))
@@ -57,5 +65,9 @@ void git_hashtable_clear(git_hashtable *h);
}\
}
+#define GIT_HASHTABLE_FOREACH_DELETE() {\
+ _node->key = NULL; _node->value = NULL; _self->key_count--;\
+}
+
#endif