diff options
Diffstat (limited to 'src/common/utils.h')
-rw-r--r-- | src/common/utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/utils.h b/src/common/utils.h index 0ac880a50..63c3f21ec 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -30,6 +30,12 @@ if (!((result) = (type *) aCalloc ((number), sizeof(type)))) \ { perror("SYSERR: malloc failure"); abort(); } } while(0) +#define CREATE_A(result, type, number) do {\ + if ((number) * sizeof(type) <= 0) \ + printf("SYSERR: Zero bytes or less requested at %s:%d.\n", __FILE__, __LINE__); \ + if (!((result) = (type *) aCallocA ((number), sizeof(type)))) \ + { perror("SYSERR: malloc failure"); abort(); } } while(0) + #define RECREATE(result,type,number) do {\ if (!((result) = (type *) aRealloc ((result), sizeof(type) * (number))))\ { printf("SYSERR: realloc failure"); abort(); } } while(0) |