aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver
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
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 'src/libmdsserver')
-rw-r--r--src/libmdsserver/hash-table.h11
-rw-r--r--src/libmdsserver/linked-list.h2
2 files changed, 12 insertions, 1 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
diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h
index e2ec884..6ed7076 100644
--- a/src/libmdsserver/linked-list.h
+++ b/src/libmdsserver/linked-list.h
@@ -274,7 +274,7 @@ int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data);
* @param node:ssize_t The variable to store the node in at each iteration
*/
#define foreach_linked_list_node(list, node) \
- for (node = list.edge; node = list.next[node], node != list.edge;)
+ for (node = (list).edge; node = (list).next[node], node != (list).edge;)
/**