From b5e55477b39213d5390d0f6a05afa85e9b05b7ea Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 8 Dec 2000 09:58:48 +0000 Subject: [PATCH] (tparam1): Change the way buffers are reallocated to be portable and less obfuscated. --- src/tparam.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tparam.c b/src/tparam.c index 7d3752713fa..0548c722198 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -1,5 +1,5 @@ /* Merge parameters into a termcap entry string. - Copyright (C) 1985, 87, 93, 95 Free Software Foundation, Inc. + Copyright (C) 1985, 87, 93, 95, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -150,21 +150,22 @@ tparam1 (string, outstring, len, up, left, argp) if (op + 5 >= outend) { register char *new; + int offset = op - outstring; + if (outlen == 0) { outlen = len + 40; new = (char *) xmalloc (outlen); - outend += 40; - bcopy (outstring, new, op - outstring); + bcopy (outstring, new, offset); } else { - outend += outlen; outlen *= 2; new = (char *) xrealloc (outstring, outlen); } - op += new - outstring; - outend += new - outstring; + + op = new + offset; + outend = new + outlen; outstring = new; } c = *p++; -- 2.39.5