summaryrefslogtreecommitdiffstats
path: root/src/tsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tsd.c')
-rw-r--r--src/tsd.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/tsd.c b/src/tsd.c
index 9614dd9..970d5ba 100644
--- a/src/tsd.c
+++ b/src/tsd.c
@@ -60,6 +60,23 @@ malloc_tsd_cleanup_register(bool (*f)(void)) {
ncleanups++;
}
+bool
+tsd_data_init(void *arg) {
+ tsd_t *tsd = (tsd_t *)arg;
+#define MALLOC_TSD_init_yes(n, t) \
+ if (n##_data_init(&tsd->n)) { \
+ return true; \
+ }
+#define MALLOC_TSD_init_no(n, t)
+#define O(n, t, gs, i, c) \
+ MALLOC_TSD_init_##i(n, t)
+MALLOC_TSD
+#undef MALLOC_TSD_init_yes
+#undef MALLOC_TSD_init_no
+#undef O
+ return false;
+}
+
void
tsd_cleanup(void *arg) {
tsd_t *tsd = (tsd_t *)arg;
@@ -72,7 +89,7 @@ tsd_cleanup(void *arg) {
#define MALLOC_TSD_cleanup_yes(n, t) \
n##_cleanup(tsd);
#define MALLOC_TSD_cleanup_no(n, t)
-#define O(n, t, gs, c) \
+#define O(n, t, gs, i, c) \
MALLOC_TSD_cleanup_##c(n, t)
MALLOC_TSD
#undef MALLOC_TSD_cleanup_yes