diff options
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/window.c b/window.c index 0c675e9..2e79a65 100644 --- a/window.c +++ b/window.c @@ -35,7 +35,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> #include <time.h> #include "chat.h" @@ -93,7 +92,7 @@ static struct Window *windowRemove(uint num) { } static void windowFree(struct Window *window) { - cacheRemove(None, idNames[window->id]); + completeRemove(None, idNames[window->id]); bufferFree(window->buffer); free(window); } @@ -107,7 +106,7 @@ uint windowFor(uint id) { } struct Window *window = calloc(1, sizeof(*window)); - if (!window) err(EX_OSERR, "malloc"); + if (!window) err(1, "malloc"); window->id = id; window->mark = true; @@ -118,7 +117,7 @@ uint windowFor(uint id) { window->thresh = windowThreshold; } window->buffer = bufferAlloc(); - cacheInsert(false, None, idNames[id])->color = idColors[id]; + completePush(None, idNames[id], idColors[id]); return windowPush(window); } @@ -132,7 +131,7 @@ void windowInit(void) { struct tm *time = localtime(&(time_t) { -22100400 }); size_t len = strftime(buf, sizeof(buf), fmt, time); - if (!len) errx(EX_CONFIG, "invalid timestamp format: %s", fmt); + if (!len) errx(1, "invalid timestamp format: %s", fmt); int y; waddstr(uiMain, buf); @@ -147,6 +146,7 @@ static int styleAdd(WINDOW *win, struct Style init, const char *str) { struct Style style = init; while (*str) { size_t len = styleParse(&style, &str); + if (!len) continue; wattr_set(win, uiAttr(style), uiPair(style), NULL); if (waddnstr(win, str, len) == ERR) return -1; @@ -477,7 +477,7 @@ void windowClose(uint num) { if (num >= count) return; if (windows[num]->id == Network) return; struct Window *window = windowRemove(num); - cacheClear(window->id); + completeRemove(window->id, NULL); windowFree(window); if (swap >= num) swap--; if (show == num) { @@ -621,14 +621,14 @@ int windowSave(FILE *file) { static time_t readTime(FILE *file) { time_t time; fread(&time, sizeof(time), 1, file); - if (ferror(file)) err(EX_IOERR, "fread"); - if (feof(file)) errx(EX_DATAERR, "unexpected eof"); + if (ferror(file)) err(1, "fread"); + if (feof(file)) errx(1, "unexpected end of save file"); return time; } static ssize_t readString(FILE *file, char **buf, size_t *cap) { ssize_t len = getdelim(buf, cap, '\0', file); - if (len < 0 && !feof(file)) err(EX_IOERR, "getdelim"); + if (len < 0 && !feof(file)) err(1, "getdelim"); return len; } |