aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2014-04-16 22:13:05 +0200
committerTharre <tharre3@gmail.com>2014-04-16 22:13:05 +0200
commit9e5c74c5711557b120945b5a2c0d6723d3427c20 (patch)
treedc366a6c93ce71c30209b74cf7f4e4184f450790 /src/util.h
parent3fbeb8a37f74bda763c7de2da63ae358fc0b1b0e (diff)
downloadredo-9e5c74c5711557b120945b5a2c0d6723d3427c20.tar.gz
redo-9e5c74c5711557b120945b5a2c0d6723d3427c20.tar.xz
redo-9e5c74c5711557b120945b5a2c0d6723d3427c20.zip
Rewrote malloc() and other wrappers
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h
index 40780d8..abfb666 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1,11 +1,20 @@
#ifndef __RUTIL_H__
#define __RUTIL_H__
+#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include "../config.h"
+#define safe_malloc(size) safe_malloc_(size, __FILENAME__, __LINE__)
+#define safe_realloc(ptr, size) safe_realloc_(ptr, size, __FILENAME__, __LINE__)
+#define safe_fopen(path, mode) safe_fopen_(path, mode, __FILENAME__, __LINE__)
+
+extern void *safe_malloc_(size_t size, const char *file, unsigned int line);
+extern void *safe_realloc_(void *ptr, size_t size, const char *file, unsigned int line);
+extern FILE *safe_fopen_(const char *path, const char *mode,
+ const char *file, unsigned int line);
extern char *concat(size_t count, ...);
-extern void *ec_malloc(size_t size);
extern char *ec_strdup(const char* str);
extern char *strdup(const char *str);
extern char *xbasename(const char *path);