aboutsummaryrefslogtreecommitdiff
path: root/include/xalloc.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-10-01 01:45:06 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-01 09:33:32 +0300
commit3afb8f079dda8439c17f191ff593b7c4bf1c4b57 (patch)
tree98e366b65e826513c078feaa31e23921a03ebd7f /include/xalloc.h
parentee3c2bef131ff1d6723b66d5cec3c8738954b407 (diff)
mtd-utils: xalloc: simplify/unify error messages
I'm not sure that if we actually are out of memory that declaring the failing allocation size is useful in the output. So use the same simple string in every error message to cut down on size (there will only be one copy of this at runtime). Size is a much more common concern than handling OOM issues which most likely aren't the fault of mtd-utils in the first place. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'include/xalloc.h')
-rw-r--r--include/xalloc.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/xalloc.h b/include/xalloc.h
index 35a94af..f1cc8d4 100644
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -41,7 +41,7 @@ static void *xmalloc(size_t size)
void *ptr = malloc(size);
if (ptr == NULL && size != 0)
- sys_errmsg_die("malloc(%zu) failed", size);
+ sys_errmsg_die("out of memory");
return ptr;
}
@@ -51,7 +51,7 @@ static void *xcalloc(size_t nmemb, size_t size)
void *ptr = calloc(nmemb, size);
if (ptr == NULL && nmemb != 0 && size != 0)
- sys_errmsg_die("calloc(%zu, %zu) failed", nmemb, size);
+ sys_errmsg_die("out of memory");
return ptr;
}
@@ -66,7 +66,7 @@ static void *xrealloc(void *ptr, size_t size)
{
ptr = realloc(ptr, size);
if (ptr == NULL && size != 0)
- sys_errmsg_die("realloc(%p, %zu) failed", ptr, size);
+ sys_errmsg_die("out of memory");
return ptr;
}
@@ -79,7 +79,7 @@ static char *xstrdup(const char *s)
return NULL;
t = strdup(s);
if (t == NULL)
- sys_errmsg_die("strdup(%p) failed", s);
+ sys_errmsg_die("out of memory");
return t;
}
@@ -97,7 +97,7 @@ static int xasprintf(char **strp, const char *fmt, ...)
va_end(ap);
if (cnt == -1)
- sys_errmsg_die("asprintf(...) failed");
+ sys_errmsg_die("out of memory");
return cnt;
}