diff options
-rw-r--r-- | dmenu.c | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -52,7 +52,6 @@ static char *cistrstr(const char *s, const char *sub); | |||
52 | static void cleanup(void); | 52 | static void cleanup(void); |
53 | static void drawmenu(void); | 53 | static void drawmenu(void); |
54 | static void drawtext(const char *text, ulong col[ColLast]); | 54 | static void drawtext(const char *text, ulong col[ColLast]); |
55 | static void *emalloc(uint size); | ||
56 | static void eprint(const char *errstr, ...); | 55 | static void eprint(const char *errstr, ...); |
57 | static ulong getcolor(const char *colstr); | 56 | static ulong getcolor(const char *colstr); |
58 | static Bool grabkeyboard(void); | 57 | static Bool grabkeyboard(void); |
@@ -252,15 +251,6 @@ drawtext(const char *text, ulong col[ColLast]) { | |||
252 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); | 251 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
253 | } | 252 | } |
254 | 253 | ||
255 | void * | ||
256 | emalloc(uint size) { | ||
257 | void *res = malloc(size); | ||
258 | |||
259 | if(!res) | ||
260 | eprint("fatal: could not malloc() %u bytes\n", size); | ||
261 | return res; | ||
262 | } | ||
263 | |||
264 | void | 254 | void |
265 | eprint(const char *errstr, ...) { | 255 | eprint(const char *errstr, ...) { |
266 | va_list ap; | 256 | va_list ap; |
@@ -563,7 +553,8 @@ readstdin(void) { | |||
563 | maxname = p; | 553 | maxname = p; |
564 | max = len; | 554 | max = len; |
565 | } | 555 | } |
566 | new = emalloc(sizeof(Item)); | 556 | if((new = (Item *)malloc(sizeof(Item))) == NULL) |
557 | eprint("fatal: could not malloc() %u bytes\n", sizeof(Item)); | ||
567 | new->next = new->left = new->right = NULL; | 558 | new->next = new->left = new->right = NULL; |
568 | new->text = p; | 559 | new->text = p; |
569 | if(!i) | 560 | if(!i) |