summaryrefslogtreecommitdiff
path: root/legacy/edje/src/bin/edje_cc_mem.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2003-06-12 22:34:51 +0000
committerCarsten Haitzler <raster@rasterman.com>2003-06-12 22:34:51 +0000
commit598dd0b60f98702c454d16619138c31e8ae71e41 (patch)
treef643b7e22a496f061cd76a407ebcf88de8e61ae5 /legacy/edje/src/bin/edje_cc_mem.c
parent228f197d2bf2a26ac2fac861007ef7a851b5c9f1 (diff)
mem allocs guaranteed now... they are wrapped and errors handled centrally
SVN revision: 7018
Diffstat (limited to 'legacy/edje/src/bin/edje_cc_mem.c')
-rw-r--r--legacy/edje/src/bin/edje_cc_mem.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/legacy/edje/src/bin/edje_cc_mem.c b/legacy/edje/src/bin/edje_cc_mem.c
new file mode 100644
index 0000000000..bbebeeb8f3
--- /dev/null
+++ b/legacy/edje/src/bin/edje_cc_mem.c
@@ -0,0 +1,27 @@
1#include "edje_cc.h"
2
3void *
4mem_alloc(size_t size)
5{
6 void *mem;
7
8 mem = calloc(1, size);
9 if (mem) return mem;
10 fprintf(stderr, "%s: Error. %s:%i memory allocation of %i bytes failed. %s\n",
11 progname, file_in, line, size, strerror(errno));
12 exit(-1);
13 return NULL;
14}
15
16char *
17mem_strdup(const char *s)
18{
19 void *str;
20
21 str = strdup(s);
22 if (str) return str;
23 fprintf(stderr, "%s: Error. %s:%i memory allocation of %i bytes failed. %s. string being duplicated: \"%s\"\n",
24 progname, file_in, line, strlen(s) + 1, strerror(errno), s);
25 exit(-1);
26 return NULL;
27}