]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - dlink.h
sysfs: Avoid if and return on the same line
[thirdparty/mdadm.git] / dlink.h
diff --git a/dlink.h b/dlink.h
index aa178e6c3267551c34629bf64a85d8f3660ea6e0..ab2a9459ba45d6dc0e90806e160f4b6c76974446 100644 (file)
--- a/dlink.h
+++ b/dlink.h
@@ -4,18 +4,18 @@
 
 struct __dl_head
 {
-    struct __dl_head * dh_prev;
-    struct __dl_head * dh_next;
+    void * dh_prev;
+    void * dh_next;
 };
 
-#define        dl_alloc(size)  ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
+#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) *((void**)&(((struct __dl_head*)(p))[-1].dh_next))
-#define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev))
+#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 *dl_head(void);
 char *dl_strdup(char *);
 char *dl_strndup(char *, int);
 void dl_insert(void*, void*);