diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-02 15:05:58 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-02 15:05:58 +0200 |
commit | 2353d07c78c02e9834cb87711b1347115744a256 (patch) | |
tree | 7c75ee72b72ae401acf40435e21d9fdfcc786870 | |
parent | 90131b80876c9f978732de4c6b0892102482413c (diff) |
sfeed: enable cleanup again
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r-- | sfeed.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -30,13 +30,15 @@ enum { AtomTagId, AtomTagLink, AtomTagAuthor }; -typedef struct string { /* String data / pool */ +/* String data / memory pool */ +typedef struct string { char *data; /* data */ size_t len; /* string length */ size_t bufsiz; /* allocated size */ } String; -typedef struct feeditem { /* Feed item */ +/* Feed item */ +typedef struct feeditem { String timestamp; String title; String link; @@ -54,7 +56,7 @@ typedef struct feedtag { } FeedTag; static void die(const char *s); -/*static void cleanup(void);*/ +static void cleanup(void); static String *currentfield = NULL; /* pointer to current FeedItem field String */ static FeedItem feeditem; /* data for current feed item */ @@ -251,8 +253,8 @@ string_append(String *s, const char *data, size_t len) { s->data[s->len] = '\0'; } -#if 0 -static void /* cleanup, free allocated memory, etc */ +/* cleanup, free allocated memory, etc */ +static void cleanup(void) { string_free(&feeditem.timestamp); string_free(&feeditem.title); @@ -261,7 +263,6 @@ cleanup(void) { string_free(&feeditem.id); string_free(&feeditem.author); } -#endif static void /* print error message to stderr */ die(const char *s) { @@ -736,7 +737,7 @@ xml_handler_end_element(XMLParser *p, const char *name, size_t namelen, int issh int main(int argc, char **argv) { -/* atexit(cleanup);*/ + atexit(cleanup); if(argc > 1) append = argv[1]; |