summaryrefslogtreecommitdiff
path: root/lib/hash.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-08-15 15:50:30 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-08-15 17:53:09 -0400
commitd3ce24ef578a95e3c8ae01c0a9c5a3545f59bd62 (patch)
tree2726ae9b9bbbd07bceed15045bf43f1a386323c8 /lib/hash.h
parentf5bffa5a7435696780d8a7f1ebe842e4cd7b3af4 (diff)
lib: Update hash.h documentation
The hash_get function when called and the alloc_func returns a NULL value, we do not create a backet nor do we insert anything into the hash. As such backet->data must always be non-NULL. Modify the description in hash_get to inform of this. Additionally indicate that hash_walk and hash_iterate cannot have a NULL backet->data value. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/hash.h')
-rw-r--r--lib/hash.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/hash.h b/lib/hash.h
index 12c214e469..2b4ea48f38 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -167,7 +167,9 @@ hash_create_size(unsigned int size, unsigned int (*hash_key)(void *),
* hash table to operate on
*
* data
- * data to insert or retrieve
+ * data to insert or retrieve - A hash backet will not be created if
+ * the alloc_func returns a NULL pointer and nothing will be added to
+ * the hash. As such backet->data will always be non-NULL.
*
* alloc_func
* function to call if the item is not found in the hash table. This
@@ -236,6 +238,8 @@ extern void *hash_release(struct hash *hash, void *data);
* during the walk will cause undefined behavior in that some new entries
* will be walked and some will not. So do not do this.
*
+ * The backet passed to func will have a non-NULL data pointer.
+ *
* hash
* hash table to operate on
*
@@ -256,6 +260,8 @@ extern void hash_iterate(struct hash *hash,
* during the walk will cause undefined behavior in that some new entries
* will be walked and some will not. So do not do this.
*
+ * The backet passed to func will have a non-NULL data pointer.
+ *
* hash
* hash table to operate on
*