mdadm/dlink.h

26 lines
689 B
C
Raw Normal View History

2001-07-26 09:00:09 +02:00
/* doubley linked lists */
/* This is free software. No strings attached. No copyright claimed */
struct __dl_head
{
void * dh_prev;
void * dh_next;
2001-07-26 09:00:09 +02:00
};
#define dl_alloc(size) ((void*)(((char*)xcalloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
2001-07-26 09:00:09 +02:00
#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))
2001-07-26 09:00:09 +02:00
2002-04-04 03:58:32 +02:00
void *dl_head(void);
2001-07-26 09:00:09 +02:00
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*);