Quellcode durchsuchen

helpful errors

master
Connor Lane Smith vor 13 Jahren
Ursprung
Commit
cd3b4915c3
2 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen
  1. +2
    -2
      dmenu.c
  2. +6
    -1
      draw.c

+ 2
- 2
dmenu.c Datei anzeigen

@@ -440,9 +440,9 @@ readstdin(void) {
if((p = strchr(buf, '\n')))
*p = '\0';
if(!(item = calloc(1, sizeof *item)))
eprintf("cannot malloc %u bytes\n", sizeof *item);
eprintf("cannot malloc %u bytes:", sizeof *item);
if(!(item->text = strdup(buf)))
eprintf("cannot strdup %u bytes\n", strlen(buf)+1);
eprintf("cannot strdup %u bytes:", strlen(buf)+1);
inputw = MAX(inputw, textw(dc, item->text));
}
}


+ 6
- 1
draw.c Datei anzeigen

@@ -68,6 +68,11 @@ eprintf(const char *fmt, ...) {
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);

if(fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
}
exit(EXIT_FAILURE);
}

@@ -101,7 +106,7 @@ initdc(void) {
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
weprintf("no locale support\n");
if(!(dc = calloc(1, sizeof *dc)))
eprintf("cannot malloc %u bytes\n", sizeof *dc);
eprintf("cannot malloc %u bytes:", sizeof *dc);
if(!(dc->dpy = XOpenDisplay(NULL)))
eprintf("cannot open display\n");



Laden…
Abbrechen
Speichern