summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-15 19:54:45 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-15 19:54:45 +0200
commitd40d30cb76ddcc9935471af0fb6fa6b2a66efc4c (patch)
treebd5bc5dad50b199a58ad4a4d5a447a6d0fda8ce6 /src
parent434bedcda0a7edb4fcc2dda6eb3df0310c2d0774 (diff)
downloadlibgit2-d40d30cb76ddcc9935471af0fb6fa6b2a66efc4c.tar.gz
Debug assertion when using an initialized hashtable
Diffstat (limited to 'src')
-rw-r--r--src/hashtable.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hashtable.c b/src/hashtable.c
index c36d8a8e6..ee6d3a461 100644
--- a/src/hashtable.c
+++ b/src/hashtable.c
@@ -184,6 +184,8 @@ int git_hashtable_insert2(git_hashtable *self, const void *key, void *value, voi
int hash_id;
git_hashtable_node *node;
+ assert(self && self->nodes);
+
*old_value = NULL;
for (hash_id = 0; hash_id < GIT_HASHTABLE_HASHES; ++hash_id) {
@@ -218,6 +220,8 @@ void *git_hashtable_lookup(git_hashtable *self, const void *key)
int hash_id;
git_hashtable_node *node;
+ assert(self && self->nodes);
+
for (hash_id = 0; hash_id < GIT_HASHTABLE_HASHES; ++hash_id) {
node = node_with_hash(self, key, hash_id);
if (node->key && self->key_equal(key, node->key) == 0)
@@ -232,6 +236,8 @@ int git_hashtable_remove(git_hashtable *self, const void *key)
int hash_id;
git_hashtable_node *node;
+ assert(self && self->nodes);
+
for (hash_id = 0; hash_id < GIT_HASHTABLE_HASHES; ++hash_id) {
node = node_with_hash(self, key, hash_id);
if (node->key && self->key_equal(key, node->key) == 0) {