commit d10b48c03250526ffd0df79ce1b74c943479c56b
parent 322672db800ff1c6a6705bc82e13886ec1f480a6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 13 Aug 2020 20:16:18 +0200
code clarity: feed_items_get: remove one tiny brain-lookup for `ret`
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1068,7 +1068,6 @@ feed_items_get(struct feed *f, FILE *fp, struct items *itemsret)
size_t cap, i, linesize = 0, nitems;
ssize_t linelen;
off_t offset;
- int ret = -1;
cap = nitems = 0;
offset = 0;
@@ -1107,16 +1106,17 @@ feed_items_get(struct feed *f, FILE *fp, struct items *itemsret)
if (linelen <= 0 || feof(fp))
break;
}
+ free(line);
itemsret->cap = cap;
itemsret->items = items;
itemsret->len = nitems;
- ret = 0;
+ return 0;
err:
- if (ret)
- feed_items_free(itemsret);
free(line);
- return ret;
+ feed_items_free(itemsret);
+
+ return -1;
}
void