aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/hash-table.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-07-28 16:53:10 +0200
committerMattias Andrée <maandree@operamail.com>2014-07-28 16:53:10 +0200
commit0cfe3b6ef1fdb4f4934a5752ca6d0d4aa3fcbf18 (patch)
tree4b919d602da3ee225dea15454cc6aacd4211687b /src/libmdsserver/hash-table.h
parentprepare for handling client closed messages (diff)
downloadmds-0cfe3b6ef1fdb4f4934a5752ca6d0d4aa3fcbf18.tar.gz
mds-0cfe3b6ef1fdb4f4934a5752ca6d0d4aa3fcbf18.tar.bz2
mds-0cfe3b6ef1fdb4f4934a5752ca6d0d4aa3fcbf18.tar.xz
unregister protocols for closing servers
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/hash-table.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libmdsserver/hash-table.h b/src/libmdsserver/hash-table.h
index edf8d3a..2f4d03b 100644
--- a/src/libmdsserver/hash-table.h
+++ b/src/libmdsserver/hash-table.h
@@ -220,6 +220,17 @@ size_t hash_table_remove(hash_table_t* restrict this, size_t key);
void hash_table_clear(hash_table_t* restrict this);
/**
+ * Wrapper for `for` keyword that iterates over entry element in a hash table
+ *
+ * @param table:hash_table_t The hans table
+ * @param i:size_t The variable to store the buckey index in at each iteration
+ * @param entry:hash_entry_t* The variable to store the entry in at each iteration
+ */
+#define foreach_hash_table_entry(table, i, entry) \
+ for (i = 0; i < (table).capacity; i++) \
+ for (entry = (table).buckets[i]; entry != NULL; entry = entry->next)
+
+/**
* Calculate the buffer size need to marshal a hash table
*
* @param this The hash table