>From bd9101ab98cd0c67ef1ec519ca18175dcdd138bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Thu, 17 Dec 2015 17:41:32 +0100 Subject: [PATCH] Cleanup code * src/iri.c (do_conversion): Code cleanup --- src/iri.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/iri.c b/src/iri.c index 6c6e8d3..354bfd9 100644 --- a/src/iri.c +++ b/src/iri.c @@ -180,16 +180,10 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz } else if (errno == E2BIG) /* Output buffer full */ { - char *new; - tooshort++; done = len; - outlen = done + inlen * 2; - new = xmalloc (outlen + 1); - memcpy (new, s, done); - xfree (s); - s = new; - len = outlen; + len = outlen = done + inlen * 2; + s = xrealloc(s, outlen + 1); *out = s + done; } else /* Weird, we got an unspecified error */ -- 2.6.4