aboutsummaryrefslogtreecommitdiff
path: root/commit-slab.h
diff options
context:
space:
mode:
Diffstat (limited to 'commit-slab.h')
-rw-r--r--commit-slab.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/commit-slab.h b/commit-slab.h
index cc114b53b..375c9c751 100644
--- a/commit-slab.h
+++ b/commit-slab.h
@@ -117,4 +117,16 @@ static int stat_ ##slabname## realloc
* catch because GCC silently parses it by default.
*/
+/*
+ * Statically initialize a commit slab named "var". Note that this
+ * evaluates "stride" multiple times! Example:
+ *
+ * struct indegree indegrees = COMMIT_SLAB_INIT(1, indegrees);
+ *
+ */
+#define COMMIT_SLAB_INIT(stride, var) { \
+ COMMIT_SLAB_SIZE / sizeof(**((var).slab)) / (stride), \
+ (stride), 0, NULL \
+}
+
#endif /* COMMIT_SLAB_H */