X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Futils.h;h=658eea2be542d9bf406b4a33ac8354c750130241;hb=7d1e14f405f389656604c68e18a381feabcd3d4a;hp=4fdde3c2d8c5c13e400cb6e161c2a4382fee794b;hpb=2b8eb6dfb02dc93372c5e0a4efa6dff73a8ba004;p=ashd.git diff --git a/lib/utils.h b/lib/utils.h index 4fdde3c..658eea2 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -8,8 +8,8 @@ #define max(a, b) (((b) > (a))?(b):(a)) #define min(a, b) (((b) < (a))?(b):(a)) -#define smalloc(size) ({void *__result__; ((__result__ = malloc(size)) == NULL)?({exit(-1); (void *)0;}):__result__;}) -#define srealloc(ptr, size) ({void *__result__; ((__result__ = realloc((ptr), (size))) == NULL)?({exit(-1); (void *)0;}):__result__;}) +#define smalloc(size) ({void *__result__; ((__result__ = malloc(size)) == NULL)?({abort(); (void *)0;}):__result__;}) +#define srealloc(ptr, size) ({void *__result__; ((__result__ = realloc((ptr), (size))) == NULL)?({abort(); (void *)0;}):__result__;}) #define szmalloc(size) memset(smalloc(size), 0, size) #define sstrdup(str) ({const char *__strbuf__ = (str); strcpy(smalloc(strlen(__strbuf__) + 1), __strbuf__);}) #define omalloc(o) ((o) = szmalloc(sizeof(*(o))))