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().
This commit is contained in:
Hiltjo Posthuma
2015-10-20 23:34:49 +02:00
parent e3b7e1d620
commit 646b351cc7
5 changed files with 165 additions and 159 deletions

30
util.c
View File

@ -2,16 +2,32 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
void
die(const char *errstr, ...) {
va_list ap;
void *
ecalloc(size_t nmemb, size_t size)
{
void *p;
va_start(ap, errstr);
vfprintf(stderr, errstr, ap);
va_end(ap);
exit(EXIT_FAILURE);
if (!(p = calloc(nmemb, size)))
perror(NULL);
return p;
}
void
die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
}
exit(1);
}