diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-24 14:34:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-24 14:34:34 +0000 |
commit | 946b54554e13d6a97940df936123855e0a305abc (patch) | |
tree | 80a778fbd7bb3c7858cfac572df1cb08cfa4f988 /dlink.h | |
parent | Initial commit. (diff) | |
download | mdadm-946b54554e13d6a97940df936123855e0a305abc.tar.xz mdadm-946b54554e13d6a97940df936123855e0a305abc.zip |
Adding upstream version 4.2.upstream/4.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dlink.h | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ + +/* doubley linked lists */ +/* This is free software. No strings attached. No copyright claimed */ + +struct __dl_head +{ + void * dh_prev; + void * dh_next; +}; + +#define dl_alloc(size) ((void*)(((char*)xcalloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head))) +#define dl_new(t) ((t*)dl_alloc(sizeof(t))) +#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n)) + +#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next)) +#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev)) + +void *dl_head(void); +char *dl_strdup(char *); +char *dl_strndup(char *, int); +void dl_insert(void*, void*); +void dl_add(void*, void*); +void dl_del(void*); +void dl_free(void*); +void dl_init(void*); |