commit 50ce17802279641e16eef36437c6e9417404a5af
parent 0ee7239b0c8c7be92bd65c468188069d287f9be5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 26 Jun 2020 12:35:34 +0200
small cleanup, read devnullfd once at startup
Diffstat:
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -951,7 +951,6 @@ feed_load(struct feed *f, FILE *fp)
struct row *row;
ssize_t want;
size_t i;
- int ret;
for (i = 0; i < nitems; i++) {
free(items[i].title);
@@ -972,8 +971,7 @@ feed_load(struct feed *f, FILE *fp)
want = -1; /* all */
- ret = feed_getitems(&items, &nitems, want, fp, 0);
- if (ret == -1)
+ if (feed_getitems(&items, &nitems, want, fp, 0) == -1)
err(1, "%s: %s", __func__, f->path);
f->totalnew = 0;
@@ -1049,13 +1047,9 @@ loadfiles(int argc, char *argv[])
/* 1 day is old news */
comparetime -= 86400;
- if ((devnullfd = open("/dev/null", O_WRONLY)) < 0)
- err(1, "open: /dev/null");
-
totalnew = totalcount = 0;
if (argc == 1) {
feeds[0].name = "stdin";
-
if (!(fp = fdopen(ttyfd, "rb")))
err(1, "fdopen");
feed_load(&feeds[0], fp);
@@ -1305,6 +1299,9 @@ main(int argc, char *argv[])
selpane = PaneItems;
}
+ if ((devnullfd = open("/dev/null", O_WRONLY)) < 0)
+ err(1, "open: /dev/null");
+
updatetitle();
updatesidebar(onlynew);
init();