minor name changes to make more sense
This commit is contained in:
@@ -83,7 +83,7 @@ static inline struct UHNode *uc_htable_first_bucket(const struct UHTable *table,
|
||||
* Get the next node in the bucket.
|
||||
* @return next node or NULL
|
||||
*/
|
||||
static inline struct UHNode *uc_htable_next_bucket(const struct UHNode *node)
|
||||
static inline struct UHNode *uc_htable_next_in_bucket(const struct UHNode *node)
|
||||
{
|
||||
return node->next;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ static inline struct UHNode *uc_htable_next_hash(const struct UHNode *node)
|
||||
|
||||
|
||||
//internal helper
|
||||
struct UHNode *uc_htable_iter_hlp(struct UHTable *table, size_t bucket);
|
||||
struct UHNode *uc_htable_iter_hlp(struct UHTable *table, size_t start_bucket);
|
||||
|
||||
/** Get the first node in the hash table
|
||||
*
|
||||
@@ -151,7 +151,7 @@ void uc_htable_swap(struct UHTable *a, struct UHTable *b);
|
||||
#define UC_HTABLE_FOREACH_BUCKET(table, node_iter, hash)\
|
||||
for ((node_iter) = uc_htable_first_bucket((table), (hash));\
|
||||
(node_iter) != NULL;\
|
||||
(node_iter) = uc_htable_next_bucket((node_iter)))
|
||||
(node_iter) = uc_htable_next_in_bucket((node_iter)))
|
||||
|
||||
/**
|
||||
* Iterate over all nodes that has the given hash.
|
||||
|
||||
+3
-3
@@ -50,13 +50,13 @@ struct UHNode *uc_htable_next_hash_hlp(struct UHNode *next, size_t hash)
|
||||
}
|
||||
|
||||
//find a node, starting at bucket
|
||||
struct UHNode *uc_htable_iter_hlp(struct UHTable *table, size_t bucket)
|
||||
struct UHNode *uc_htable_iter_hlp(struct UHTable *table, size_t start_bucket)
|
||||
{
|
||||
size_t i;
|
||||
struct UHNode *found = NULL;
|
||||
|
||||
//search through buckets until a node is found
|
||||
for (i = bucket; i < table->cnt_buckets; i++) {
|
||||
for (i = start_bucket; i < table->cnt_buckets; i++) {
|
||||
found = uc_htable_first_bucket(table, i);
|
||||
if (found != NULL) {
|
||||
break;
|
||||
@@ -69,7 +69,7 @@ struct UHNode *uc_htable_next(struct UHTable *table, struct UHNode *node)
|
||||
{
|
||||
struct UHNode *found;
|
||||
|
||||
found = uc_htable_next_bucket(node);
|
||||
found = uc_htable_next_in_bucket(node);
|
||||
if (found == NULL) {
|
||||
size_t current_bucket = uc_htable_bucket(table, node->hash);
|
||||
found = uc_htable_iter_hlp(table, current_bucket + 1);
|
||||
|
||||
Reference in New Issue
Block a user