]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Add some documentation
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 6 Jul 2018 14:18:50 +0000 (10:18 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 6 Jul 2018 14:18:50 +0000 (10:18 -0400)
Add some documentation to hash_walk/iterate to tell people
to not do something stupid.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/hash.h

index c7e670b7238affa725ae7c038d484fad5870de4c..12c214e469571d10f1360b9f9adba736c27a4d15 100644 (file)
@@ -232,7 +232,9 @@ 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.
+ * table during 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.
  *
  * hash
  *    hash table to operate on
@@ -250,7 +252,9 @@ extern void hash_iterate(struct hash *hash,
  * Iterate over the elements in a hash table, stopping on condition.
  *
  * It is safe to delete items passed to the iteration function from the hash
- * table during iteration.
+ * table during 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.
  *
  * hash
  *    hash table to operate on