Introduction
Introduction Statistics Contact Development Disclaimer Help
improve consistency of line counting (on an invalid file) - sfeed_curses - sfee…
git clone git://git.codemadness.org/sfeed_curses
Log
Files
Refs
README
LICENSE
---
commit 827f4afdcecbb6cb53ee60d52d068ce5f94bbaac
parent 1d4e2e3f6913318cdfce03f08bb517a8c8ebbc56
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 10 Jul 2021 19:14:48 +0200
improve consistency of line counting (on an invalid file)
This only happens when there is an invalid sfeed(5) feed file with an empty
line. The feed_items_get() function would stop further processing, but the
feed_count() function did not.
Diffstat:
M sfeed_curses.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1262,7 +1262,7 @@ feed_items_get(struct feed *f, FILE *fp, struct items *it…
struct item *item, *items = NULL;
char *line = NULL;
size_t cap, i, linesize = 0, nitems;
- ssize_t linelen;
+ ssize_t linelen, n;
off_t offset;
int ret = -1;
@@ -1273,7 +1273,7 @@ feed_items_get(struct feed *f, FILE *fp, struct items *it…
cap = cap ? cap * 2 : 16;
items = erealloc(items, cap * sizeof(struct item));
}
- if ((linelen = getline(&line, &linesize, fp)) > 0) {
+ if ((n = linelen = getline(&line, &linesize, fp)) > 0) {
item = &items[i];
item->offset = offset;
@@ -1296,7 +1296,7 @@ feed_items_get(struct feed *f, FILE *fp, struct items *it…
}
if (ferror(fp))
goto err;
- if (linelen <= 0 || feof(fp))
+ if (n <= 0 || feof(fp))
break;
}
ret = 0;
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.