summaryrefslogtreecommitdiffstats
path: root/dlink.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-07-09 09:14:16 +0200
committerNeilBrown <neilb@suse.de>2012-07-09 09:14:16 +0200
commit503975b9d5f0696b5d2ee20ea903b859e3f60662 (patch)
tree171c9f9b9db109325fad7f81ba07671d84a085a5 /dlink.h
parentRemove re_add flag in favour of new disposition. (diff)
downloadmdadm-503975b9d5f0696b5d2ee20ea903b859e3f60662.tar.xz
mdadm-503975b9d5f0696b5d2ee20ea903b859e3f60662.zip
Remove scattered checks for malloc success.
malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'dlink.h')
-rw-r--r--dlink.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/dlink.h b/dlink.h
index 8e3f4cf9..ab2a9459 100644
--- a/dlink.h
+++ b/dlink.h
@@ -8,7 +8,7 @@ struct __dl_head
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))