diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-05-13 10:07:52 +0000 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-05-13 10:07:52 +0000 |
commit | c334bcf1862a48ebb37e80aca319d4aa5baad061 (patch) | |
tree | 227c6be05a7d77120859ebd766e8fea1468407d9 /sfeed_stats.c | |
parent | c3b5da658eeef51b1444060aa107fc413ea0f436 (diff) |
cleanup, tested with tcc
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat (limited to 'sfeed_stats.c')
-rw-r--r-- | sfeed_stats.c | 10 |
1 files changed, 4 insertions, 6 deletions
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"); |