diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-09-30 01:27:38 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-09-30 08:54:05 +0300 |
commit | b2dc086600f64d5a2db179fb6bed79a0a78228e4 (patch) | |
tree | 9a49989ca2ec2b2ee74f1399be1d9d8469ef8af7 /mkfs.jffs2.c | |
parent | 94a20240f9d6776619d7652013bb10131ddad1fc (diff) |
mtd-utils: new memory wrappers
The mkfs.jffs2 program has local wrappers for memory related functions
that are useful beyond mkfs.jffs2, so break them out into a common header.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'mkfs.jffs2.c')
-rw-r--r-- | mkfs.jffs2.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c index 1abe09c..1ea3598 100644 --- a/mkfs.jffs2.c +++ b/mkfs.jffs2.c @@ -110,7 +110,6 @@ static int squash_uids = 0; static int squash_perms = 0; static int fake_times = 0; int target_endian = __BYTE_ORDER; -static const char *const memory_exhausted = "memory exhausted"; uint32_t find_hardlink(struct filesystem_entry *e) { @@ -197,46 +196,6 @@ static void perror_msg_and_die(const char *s, ...) exit(EXIT_FAILURE); } -#ifndef DMALLOC -extern void *xmalloc(size_t size) -{ - void *ptr = malloc(size); - - if (ptr == NULL && size != 0) - error_msg_and_die(memory_exhausted); - return ptr; -} - -extern void *xcalloc(size_t nmemb, size_t size) -{ - void *ptr = calloc(nmemb, size); - - if (ptr == NULL && nmemb != 0 && size != 0) - error_msg_and_die(memory_exhausted); - return ptr; -} - -extern void *xrealloc(void *ptr, size_t size) -{ - ptr = realloc(ptr, size); - if (ptr == NULL && size != 0) - error_msg_and_die(memory_exhausted); - return ptr; -} - -extern char *xstrdup(const char *s) -{ - char *t; - - if (s == NULL) - return NULL; - t = strdup(s); - if (t == NULL) - error_msg_and_die(memory_exhausted); - return t; -} -#endif - extern char *xreadlink(const char *path) { static const int GROWBY = 80; /* how large we will grow strings by */ |