lib: add doc to clear-up hash_iterate multi deletion

Add some header documentation to make it clear that you
cannot delete more than one item during each iteration.
Doing so could cause memory corruption for next pointer
if its also deleted from the table.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2020-09-01 16:02:12 -04:00
parent 8f830b8c64
commit 3509dd49c0

View file

@ -236,7 +236,8 @@ extern void *hash_release(struct hash *hash, void *data);
* Iterate over the elements in a hash table.
*
* It is safe to delete items passed to the iteration function from the hash
* table during iteration. Please note that adding entries to the hash
* table during iteration. More than one item cannot be deleted during each
* iteration. Please note that adding entries to the 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.
*