From c334bcf1862a48ebb37e80aca319d4aa5baad061 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 13 May 2014 10:07:52 +0000 Subject: cleanup, tested with tcc Signed-off-by: Hiltjo Posthuma --- sfeed_stats.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sfeed_stats.c') diff --git a/sfeed_stats.c b/sfeed_stats.c index 377c31f..13b505c 100644 --- a/sfeed_stats.c +++ b/sfeed_stats.c @@ -15,11 +15,10 @@ cleanup(void) { feedsfree(feeds); /* free feeds linked-list */ } -static void /* print error message to stderr */ +/* print error message to stderr */ +static void die(const char *s) { - fputs("sfeed_stats: ", stderr); - fputs(s, stderr); - fputc('\n', stderr); + fprintf(stderr, "sfeed_stats: %s\n", s); exit(EXIT_FAILURE); } @@ -41,9 +40,8 @@ main(void) { while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) { parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10); - isnew = (parsedtime >= comparetime); + isnew = (parsedtime >= comparetime) ? 1 : 0; /* first of feed section or new feed section. */ - /* TODO: allocate fcur before here, fcur can be NULL */ if(!totalfeeds || (fcur && strcmp(fcur->name, fields[FieldFeedName]))) { if(!(f = calloc(1, sizeof(struct feed)))) die("can't allocate enough memory"); -- cgit v1.2.3