aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/dmenu.c b/dmenu.c
index bf74edb..fa7bbe8 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -52,7 +52,6 @@ static char *cistrstr(const char *s, const char *sub);
52static void cleanup(void); 52static void cleanup(void);
53static void drawmenu(void); 53static void drawmenu(void);
54static void drawtext(const char *text, ulong col[ColLast]); 54static void drawtext(const char *text, ulong col[ColLast]);
55static void *emalloc(uint size);
56static void eprint(const char *errstr, ...); 55static void eprint(const char *errstr, ...);
57static ulong getcolor(const char *colstr); 56static ulong getcolor(const char *colstr);
58static Bool grabkeyboard(void); 57static 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
255void *
256emalloc(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
264void 254void
265eprint(const char *errstr, ...) { 255eprint(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)