Comment the FOREACH macros

This commit is contained in:
Nils O. Selåsdal
2013-10-18 19:43:05 +02:00
parent 7ff33c113b
commit 2cd5d9d7a9
+25
View File
@@ -140,16 +140,41 @@ struct UHNode *uc_htable_next(struct UHTable *table, struct UHNode *node);
*/ */
void uc_htable_swap(struct UHTable *a, struct UHTable *b); void uc_htable_swap(struct UHTable *a, struct UHTable *b);
/**
* Iterate over all nodes in a bucket.
* The table must not be changed while iterating.
*
* @param table the struct UHTable*
* @param node_iter struct UHNode* for the current node being iterated
* @param hash size_t hash for the bucket to iterate
*/
#define UC_HTABLE_FOREACH_BUCKET(table, node_iter, hash)\ #define UC_HTABLE_FOREACH_BUCKET(table, node_iter, hash)\
for ((node_iter) = uc_htable_first_bucket((table), (hash));\ for ((node_iter) = uc_htable_first_bucket((table), (hash));\
(node_iter) != NULL;\ (node_iter) != NULL;\
(node_iter) = uc_htable_next_bucket((node_iter))) (node_iter) = uc_htable_next_bucket((node_iter)))
/**
* Iterate over all nodes that has the given hash.
* The table must not be changed while iterating.
* Normally the user would check in a user specific way
* if the node_iter is equal to the node one wants to find.
*
* @param table the struct UHTable*
* @param node_iter struct UHNode* for the current node being iterated
* @param hash size_t hash for the node(s) to iterate over
*/
#define UC_HTABLE_FOREACH_HASH(table, node_iter, hash)\ #define UC_HTABLE_FOREACH_HASH(table, node_iter, hash)\
for ((node_iter) = uc_htable_first_hash((table), (hash));\ for ((node_iter) = uc_htable_first_hash((table), (hash));\
(node_iter) != NULL;\ (node_iter) != NULL;\
(node_iter) = uc_htable_next_hash((node_iter))) (node_iter) = uc_htable_next_hash((node_iter)))
/**
* Iterate over all nodes in a table
* The table must not be changed while iterating.
*
* @param table the struct UHTable*
* @param node_iter struct UHNode* for the current node being iterated
*/
#define UC_HTABLE_FOREACH(table, node_iter)\ #define UC_HTABLE_FOREACH(table, node_iter)\
for ((node_iter) = uc_htable_first((table));\ for ((node_iter) = uc_htable_first((table));\
(node_iter) != NULL;\ (node_iter) != NULL;\