aboutsummaryrefslogtreecommitdiff
path: root/list.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-12-25 04:06:18 +0800
committerMistivia <i@mistivia.com>2025-12-25 04:06:18 +0800
commit1992412fd007600856896924f04d460bb212c9f1 (patch)
treeed4ecb5e3106a004588c1a0b00c0a87d6e089b1a /list.h
parent1b59dbec2cc58b6b2404cf1732239e70a4915c69 (diff)
add create interface
Diffstat (limited to 'list.h')
-rw-r--r--list.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/list.h b/list.h
index 6eb17e9..949677c 100644
--- a/list.h
+++ b/list.h
@@ -20,6 +20,7 @@
size_t len; \
} T##List; \
void T##List_init(T##List *self); \
+ T##List T##List_create(); \
void T##List_free(T##List *self); \
T##List T##List_move(T##List *self); \
T##ListIter T##List_insert_before(T##List *self, T##ListIter iter, T val); \
@@ -48,6 +49,11 @@ LIST_DEF(Int);
self->vtail->prev = self->vhead; \
self->len = 0; \
} \
+ T##List T##List_create() { \
+ T##List self; \
+ T##List_init(&self); \
+ return self; \
+ } \
void T##List_free(T##List *self) { \
T##ListIter cur = self->vhead; \
while (cur != NULL) { \