commit 6bab880600341a7d8b7740e098dab8d5c278bdd5
parent ada0084c4c1137d4e6f7f863fb66a8af77cf240d
Author: Robert Russell <robertrussell.72001@gmail.com>
Date: Sun, 24 Sep 2023 20:15:46 -0700
Typedef the spec struct for tables
Diffstat:
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/inc/table/impl/declare.h b/inc/table/impl/declare.h
@@ -5,14 +5,14 @@
* specialized; see macro.h for details. */
/* TODO: Add PAGE_LEN and LF_{NUM,DEN} to the spec struct so that they are
* controllable at run-time? */
-struct TABLE_METHOD(spec) {
+typedef struct {
TABLE_KSIZE_FIELD
TABLE_VSIZE_FIELD
TABLE_EQ_FIELD
TABLE_HASH_FIELD
TABLE_ALLOCZ_FIELD
TABLE_FREE_FIELD
-};
+} TABLE_S;
#endif
/* TODO: Add methods for shrinking the table and reserving space? */
diff --git a/inc/table/impl/macro.h b/inc/table/impl/macro.h
@@ -47,7 +47,10 @@
#endif
#ifdef TABLE_USE_SPEC
-#define TABLE_SPEC_PARAM , struct TABLE_METHOD(spec) *s_
+#ifndef TABLE_S
+#error "rcx/table: TABLE_S must be defined"
+#endif
+#define TABLE_SPEC_PARAM , TABLE_S *s_
#define TABLE_SPEC , s_
#undef TABLE_USE_SPEC
#endif
diff --git a/inc/table/impl/unmacro.h b/inc/table/impl/unmacro.h
@@ -5,6 +5,7 @@
#undef TABLE_METHOD
#undef TABLE_SPEC
#undef TABLE_SPEC_PARAM
+#undef TABLE_S
#undef TABLE_FREE_FIELD
#undef TABLE_FREE
#undef TABLE_ALLOCZ_FIELD