2009-10-25 04:19:12 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2008-10-26 10:18:19 -07:00
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2003-06-12 15:34:51 -07:00
|
|
|
#include "edje_cc.h"
|
|
|
|
|
|
|
|
void *
|
|
|
|
mem_alloc(size_t size)
|
|
|
|
{
|
|
|
|
void *mem;
|
2008-03-24 01:22:01 -07:00
|
|
|
|
2003-06-12 15:34:51 -07:00
|
|
|
mem = calloc(1, size);
|
|
|
|
if (mem) return mem;
|
2012-07-31 15:42:03 -07:00
|
|
|
ERR("%s:%i memory allocation of %zu bytes failed. %s",
|
|
|
|
file_in, line, size, strerror(errno));
|
2003-06-12 15:34:51 -07:00
|
|
|
exit(-1);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
mem_strdup(const char *s)
|
|
|
|
{
|
|
|
|
void *str;
|
2008-03-24 01:22:01 -07:00
|
|
|
|
2003-06-12 15:34:51 -07:00
|
|
|
str = strdup(s);
|
|
|
|
if (str) return str;
|
2012-07-31 15:42:03 -07:00
|
|
|
ERR("%s:%i memory allocation of %zu bytes failed. %s. string being duplicated: \"%s\"",
|
|
|
|
file_in, line, strlen(s) + 1, strerror(errno), s);
|
2003-06-12 15:34:51 -07:00
|
|
|
exit(-1);
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-02-26 13:15:30 -08:00
|
|
|
|