summaryrefslogtreecommitdiff
path: root/src/common/malloc.c
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-04-02 15:09:18 +0000
committerDennis Friis <peavey@placid.dk>2008-04-02 15:09:18 +0000
commit97bb21a79949779df76269b087f3bce7ef8179ee (patch)
tree08b3bdee2f3596581dd8d8f051afd37ee648cee7 /src/common/malloc.c
parentdafdbbe9f1db3e6943003a79a6e23c00da2f2fe1 (diff)
downloadtmwa-97bb21a79949779df76269b087f3bce7ef8179ee.tar.gz
tmwa-97bb21a79949779df76269b087f3bce7ef8179ee.tar.bz2
tmwa-97bb21a79949779df76269b087f3bce7ef8179ee.tar.xz
tmwa-97bb21a79949779df76269b087f3bce7ef8179ee.zip
initial checkin
Diffstat (limited to 'src/common/malloc.c')
-rw-r--r--src/common/malloc.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
new file mode 100644
index 0000000..eda9bc2
--- /dev/null
+++ b/src/common/malloc.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "malloc.h"
+
+void* aMalloc_( size_t size, const char *file, int line, const char *func )
+{
+ void *ret;
+
+// printf("%s:%d: in func %s: malloc %d\n",file,line,func,size);
+ ret=malloc(size);
+ if(ret==NULL){
+ printf("%s:%d: in func %s: malloc error out of memory!\n",file,line,func);
+ exit(1);
+
+ }
+ return ret;
+}
+void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func )
+{
+ void *ret;
+
+// printf("%s:%d: in func %s: calloc %d %d\n",file,line,func,num,size);
+ ret=calloc(num,size);
+ if(ret==NULL){
+ printf("%s:%d: in func %s: calloc error out of memory!\n",file,line,func);
+ exit(1);
+
+ }
+ return ret;
+}
+
+void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func )
+{
+ void *ret;
+
+// printf("%s:%d: in func %s: realloc %p %d\n",file,line,func,p,size);
+ ret=realloc(p,size);
+ if(ret==NULL){
+ printf("%s:%d: in func %s: realloc error out of memory!\n",file,line,func);
+ exit(1);
+
+ }
+ return ret;
+}