diff options
| author | Mistivia <i@mistivia.com> | 2025-12-25 04:06:18 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-12-25 04:06:18 +0800 |
| commit | 1992412fd007600856896924f04d460bb212c9f1 (patch) | |
| tree | ed4ecb5e3106a004588c1a0b00c0a87d6e089b1a /list.h | |
| parent | 1b59dbec2cc58b6b2404cf1732239e70a4915c69 (diff) | |
add create interface
Diffstat (limited to 'list.h')
| -rw-r--r-- | list.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) { \ |
