summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorRobert Buchholz <rbu@goodpoint.de>2012-07-16 23:56:54 +0200
committerNeilBrown <neilb@suse.de>2012-09-10 09:23:59 +0200
commit1cc101f3f873fac4110aeece95bfe391fc8680c2 (patch)
treedc5c355cd1b00cc7c729c2986f7f863f23f320fe /util.c
parentmapfile: fix mapfile rebuild for containers (diff)
downloadmdadm-1cc101f3f873fac4110aeece95bfe391fc8680c2.tar.xz
mdadm-1cc101f3f873fac4110aeece95bfe391fc8680c2.zip
Move xmalloc et al into their own file
This avoid code duplication for utilities that do not link to util.c and everything that comes with it, such as test_restripe and raid6check Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r--util.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/util.c b/util.c
index 5a573927..a92a663b 100644
--- a/util.c
+++ b/util.c
@@ -1807,43 +1807,3 @@ struct mdinfo *container_choose_spares(struct supertype *st,
}
return disks;
}
-
-void *xmalloc(size_t len)
-{
- void *rv = malloc(len);
- char *msg;
- if (rv)
- return rv;
- msg = Name ": memory allocation failure - aborting\n";
- exit(4+!!write(2, msg, strlen(msg)));
-}
-
-void *xrealloc(void *ptr, size_t len)
-{
- void *rv = realloc(ptr, len);
- char *msg;
- if (rv)
- return rv;
- msg = Name ": memory allocation failure - aborting\n";
- exit(4+!!write(2, msg, strlen(msg)));
-}
-
-void *xcalloc(size_t num, size_t size)
-{
- void *rv = calloc(num, size);
- char *msg;
- if (rv)
- return rv;
- msg = Name ": memory allocation failure - aborting\n";
- exit(4+!!write(2, msg, strlen(msg)));
-}
-
-char *xstrdup(const char *str)
-{
- char *rv = strdup(str);
- char *msg;
- if (rv)
- return rv;
- msg = Name ": memory allocation failure - aborting\n";
- exit(4+!!write(2, msg, strlen(msg)));
-}