diff --git a/nbase/nbase_memalloc.c b/nbase/nbase_memalloc.c index c90c5f8a2..442607512 100644 --- a/nbase/nbase_memalloc.c +++ b/nbase/nbase_memalloc.c @@ -99,23 +99,23 @@ #include "nbase.h" #include -static void fatal(char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +static void fatal(char *fmt, ...) __attribute__ ((format(printf, 1, 2))); -static void fatal(char *fmt, ...) -{ -va_list ap; -va_start(ap, fmt); -fflush(stdout); -vfprintf(stderr, fmt, ap); -fprintf(stderr, "\nQUITTING!\n"); -va_end(ap); -exit(1); +static void fatal(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + fflush(stdout); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\nQUITTING!\n"); + va_end(ap); + exit(1); } -void *safe_malloc(size_t size) -{ +void *safe_malloc(size_t size) { void *mymem; - if ((int) size < 0) /* Catch caller errors */ + + if ((int)size < 0) /* Catch caller errors */ fatal("Tried to malloc negative amount of memory!!!"); mymem = malloc(size); if (mymem == NULL) @@ -123,10 +123,10 @@ void *safe_malloc(size_t size) return mymem; } -void *safe_realloc(void *ptr, size_t size) -{ +void *safe_realloc(void *ptr, size_t size) { void *mymem; - if ((int) size < 0) /* Catch caller errors */ + + if ((int)size < 0) /* Catch caller errors */ fatal("Tried to realloc negative amount of memory!!!"); mymem = realloc(ptr, size); if (mymem == NULL) @@ -135,10 +135,10 @@ void *safe_realloc(void *ptr, size_t size) } /* Zero-initializing version of safe_malloc */ -void *safe_zalloc(size_t size) -{ +void *safe_zalloc(size_t size) { void *mymem; - if ((int) size < 0) + + if ((int)size < 0) fatal("Tried to malloc negative amount of memory!!!"); mymem = calloc(1, size); if (mymem == NULL)