|
|
@ -18,15 +18,6 @@ emalloc(unsigned int size) { |
|
|
|
return res; |
|
|
|
return res; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char * |
|
|
|
|
|
|
|
estrdup(const char *str) { |
|
|
|
|
|
|
|
void *res = strdup(str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!res) |
|
|
|
|
|
|
|
eprint("fatal: could not malloc() %u bytes\n", strlen(str)); |
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
eprint(const char *errstr, ...) { |
|
|
|
eprint(const char *errstr, ...) { |
|
|
|
va_list ap; |
|
|
|
va_list ap; |
|
|
@ -36,3 +27,12 @@ eprint(const char *errstr, ...) { |
|
|
|
va_end(ap); |
|
|
|
va_end(ap); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char * |
|
|
|
|
|
|
|
estrdup(const char *str) { |
|
|
|
|
|
|
|
void *res = strdup(str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!res) |
|
|
|
|
|
|
|
eprint("fatal: could not malloc() %u bytes\n", strlen(str)); |
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|