sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit c7a1de18bd5d1790ed3be2fc151a9e23a2c7f638
parent b5c3d48091fb2856d768223deb42d3674edcc7b2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 28 Jul 2015 21:28:34 +0200

sfeed_plain: xbasename, free memory after use

Diffstat:
Msfeed_plain.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sfeed_plain.c b/sfeed_plain.c @@ -15,11 +15,10 @@ printfeed(FILE *fp, const char *feedname) { char *fields[FieldLast]; time_t parsedtime; - int r; while(parseline(&line, &size, fields, FieldLast, '\t', fp) > 0) { - r = strtotime(fields[FieldUnixTimestamp], &parsedtime); - if(r != -1 && parsedtime >= comparetime) + if(strtotime(fields[FieldUnixTimestamp], &parsedtime) != -1 && + parsedtime >= comparetime) fputs(" N ", stdout); else fputs(" ", stdout); @@ -38,6 +37,7 @@ int main(int argc, char *argv[]) { FILE *fp; + char *name; int i; /* 1 day is old news */ @@ -49,7 +49,9 @@ main(int argc, char *argv[]) for(i = 1; i < argc; i++) { if(!(fp = fopen(argv[i], "r"))) err(1, "fopen: %s", argv[i]); - printfeed(fp, xbasename(argv[i])); + name = xbasename(argv[i]); + printfeed(fp, name); + free(name); if(ferror(fp)) err(1, "ferror: %s", argv[i]); fclose(fp);