X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Fxmalloc.c;h=47ee42791d049f6622b08c5f3cbe17a810678675;hb=60ade3bddea81d39496893b501d60ced4c264cc7;hp=de5ab71e5dc1ddf5e7e196ef5862ffd9ffaa4941;hpb=74d5a9023b48f346eead323a74e28297659e34b7;p=libfirm diff --git a/ir/adt/xmalloc.c b/ir/adt/xmalloc.c index de5ab71e5..47ee42791 100644 --- a/ir/adt/xmalloc.c +++ b/ir/adt/xmalloc.c @@ -21,7 +21,6 @@ * @file * @brief implementation of xmalloc & friends * @author Markus Armbruster - * @version $Id$ */ /* @@@ ToDo: replace this file with the one from liberty. @@ -29,6 +28,7 @@ #include "config.h" #include +#include #include #include "xmalloc.h" @@ -36,7 +36,9 @@ static NORETURN xnomem(void) { - panic("out of memory"); + /* Do not use panic() here, because it might try to allocate memory! */ + fputs("out of memory", stderr); + abort(); } void *xmalloc(size_t size) @@ -59,5 +61,5 @@ void *xrealloc(void *ptr, size_t size) char *xstrdup(const char *str) { size_t len = strlen (str) + 1; - return memcpy((xmalloc) (len), str, len); + return (char*) memcpy(xmalloc(len), str, len); }