summaryrefslogtreecommitdiff
path: root/commit-slab-decl.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-19 05:28:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-21 05:07:19 (GMT)
commit878f0bb81990170cde5dba934fcd1ae4c2e698ee (patch)
treea2296212454a358f27580bc3b9dd8cecc51c3594 /commit-slab-decl.h
parenta9f1f1f9f8b2873c43d6100717eb776ea288ed9e (diff)
downloadgit-878f0bb81990170cde5dba934fcd1ae4c2e698ee.zip
git-878f0bb81990170cde5dba934fcd1ae4c2e698ee.tar.gz
git-878f0bb81990170cde5dba934fcd1ae4c2e698ee.tar.bz2
commit-slab: support shared commit-slab
define_shared_commit_slab() could be used in a header file to define a commit-slab. One of these C files must include commit-slab-impl.h and "call" implement_shared_commit_slab(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-slab-decl.h')
-rw-r--r--commit-slab-decl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/commit-slab-decl.h b/commit-slab-decl.h
index fb5220f..adc7b46 100644
--- a/commit-slab-decl.h
+++ b/commit-slab-decl.h
@@ -27,4 +27,17 @@ struct slabname { \
(stride), 0, NULL \
}
+#define declare_commit_slab_prototypes(slabname, elemtype) \
+ \
+void init_ ##slabname## _with_stride(struct slabname *s, unsigned stride); \
+void init_ ##slabname(struct slabname *s); \
+void clear_ ##slabname(struct slabname *s); \
+elemtype *slabname## _at_peek(struct slabname *s, const struct commit *c, int add_if_missing); \
+elemtype *slabname## _at(struct slabname *s, const struct commit *c); \
+elemtype *slabname## _peek(struct slabname *s, const struct commit *c)
+
+#define define_shared_commit_slab(slabname, elemtype) \
+ declare_commit_slab(slabname, elemtype); \
+ declare_commit_slab_prototypes(slabname, elemtype)
+
#endif /* COMMIT_SLAB_HDR_H */