From 646b351cc79845f4cc77415dfff474b9ae0053d9 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 20 Oct 2015 23:34:49 +0200 Subject: sync updated drw code from dmenu important: - drw_rect: didn't use w and h, change the dwm code accordingly. - drw_text: text is NULL is not allowed, use drw_rect(). --- util.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 51acd1a..6b703e9 100644 --- a/util.c +++ b/util.c @@ -2,16 +2,32 @@ #include #include #include +#include #include "util.h" +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + perror(NULL); + return p; +} + void -die(const char *errstr, ...) { +die(const char *fmt, ...) { va_list ap; - va_start(ap, errstr); - vfprintf(stderr, errstr, ap); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); va_end(ap); - exit(EXIT_FAILURE); -} + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } + + exit(1); +} -- cgit v1.2.3-54-g00ecf