sfeed

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

commit 3c79aea2a6bfe7e5256c08e8f762b48d8c58d8e6
parent 3606cc675c8cfed49091421b7197a3667d5d12cb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 19 Mar 2016 13:03:01 +0100

don't use temporary pointer for realloc, it will exit on error

Diffstat:
Msfeed.c | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -204,15 +204,13 @@ string_clear(String *s) static void string_buffer_realloc(String *s, size_t newlen) { - char *p; size_t alloclen; for (alloclen = 64; alloclen <= newlen; alloclen *= 2) ; - if (!(p = realloc(s->data, alloclen))) + if (!(s->data = realloc(s->data, alloclen))) err(1, "realloc"); s->bufsiz = alloclen; - s->data = p; } static void @@ -376,7 +374,7 @@ string_print_encoded(String *s) /* skip leading whitespace */ for (p = s->data; *p && isspace((int)*p); p++) ; - /* seek offset of trailing whitespace */ + /* seek location of trailing whitespace */ for (e = s->data + s->len; e > p && isspace((int)*(e - 1)); e--) ; @@ -407,7 +405,7 @@ string_print_trimmed(String *s) /* skip leading whitespace */ for (p = s->data; *p && isspace((int)*p); p++) ; - /* seek offset of trailing whitespace */ + /* seek location of trailing whitespace */ for (e = s->data + s->len; e > p && isspace((int)*(e - 1)); e--) ;