aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/util.c b/util.c
deleted file mode 100644
index ff943d0..0000000
--- a/util.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/* See LICENSE file for copyright and license details. */
2#include "dmenu.h"
3#include <stdarg.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7
8void *
9emalloc(unsigned int size) {
10 void *res = malloc(size);
11
12 if(!res)
13 eprint("fatal: could not malloc() %u bytes\n", size);
14 return res;
15}
16
17void
18eprint(const char *errstr, ...) {
19 va_list ap;
20
21 va_start(ap, errstr);
22 vfprintf(stderr, errstr, ap);
23 va_end(ap);
24 exit(EXIT_FAILURE);
25}
26
27char *
28estrdup(const char *str) {
29 void *res = strdup(str);
30
31 if(!res)
32 eprint("fatal: could not malloc() %u bytes\n", strlen(str));
33 return res;
34}