diff options
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 12 |
1 files changed, 4 insertions, 8 deletions
| @@ -12,8 +12,7 @@ | |||
| 12 | /* extern */ | 12 | /* extern */ |
| 13 | 13 | ||
| 14 | void * | 14 | void * |
| 15 | emallocz(unsigned int size) | 15 | emallocz(unsigned int size) { |
| 16 | { | ||
| 17 | void *res = calloc(1, size); | 16 | void *res = calloc(1, size); |
| 18 | 17 | ||
| 19 | if(!res) | 18 | if(!res) |
| @@ -22,8 +21,7 @@ emallocz(unsigned int size) | |||
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | void | 23 | void |
| 25 | eprint(const char *errstr, ...) | 24 | eprint(const char *errstr, ...) { |
| 26 | { | ||
| 27 | va_list ap; | 25 | va_list ap; |
| 28 | 26 | ||
| 29 | va_start(ap, errstr); | 27 | va_start(ap, errstr); |
| @@ -33,8 +31,7 @@ eprint(const char *errstr, ...) | |||
| 33 | } | 31 | } |
| 34 | 32 | ||
| 35 | void * | 33 | void * |
| 36 | erealloc(void *ptr, unsigned int size) | 34 | erealloc(void *ptr, unsigned int size) { |
| 37 | { | ||
| 38 | void *res = realloc(ptr, size); | 35 | void *res = realloc(ptr, size); |
| 39 | if(!res) | 36 | if(!res) |
| 40 | eprint("fatal: could not malloc() %u bytes\n", size); | 37 | eprint("fatal: could not malloc() %u bytes\n", size); |
| @@ -42,8 +39,7 @@ erealloc(void *ptr, unsigned int size) | |||
| 42 | } | 39 | } |
| 43 | 40 | ||
| 44 | void | 41 | void |
| 45 | spawn(Arg *arg) | 42 | spawn(Arg *arg) { |
| 46 | { | ||
| 47 | static char *shell = NULL; | 43 | static char *shell = NULL; |
| 48 | 44 | ||
| 49 | if(!shell && !(shell = getenv("SHELL"))) | 45 | if(!shell && !(shell = getenv("SHELL"))) |
