summaryrefslogtreecommitdiff
path: root/src/common/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/utils.h')
-rw-r--r--src/common/utils.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/common/utils.h b/src/common/utils.h
index 248bcd867..63c3f21ec 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -1,5 +1,6 @@
-#ifndef UTILS_H
-#define UTILS_H
+#ifndef COMMON_UTILS_H
+#define COMMON_UTILS_H
+
#ifndef NULL
#define NULL (void *)0
@@ -20,16 +21,23 @@
#endif
-void dump(unsigned char *buffer, int num);
+ void dump(unsigned char *buffer, int num);
+
#define CREATE(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 *) calloc ((number), sizeof(type)))) \
+ 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 *) realloc ((result), sizeof(type) * (number))))\
+ if (!((result) = (type *) aRealloc ((result), sizeof(type) * (number))))\
{ printf("SYSERR: realloc failure"); abort(); } } while(0)
struct StringBuf {