# HG changeset patch # User Gerd Moellmann # Date 976269528 0 # Node ID c6d74397e65fc738e01dd696ca178b59e76a3eb0 # Parent 09d0a988515c7a28b300d15356da6692daac4870 (tparam1): Change the way buffers are reallocated to be portable and less obfuscated. diff -r 09d0a988515c -r c6d74397e65f src/tparam.c --- a/src/tparam.c Fri Dec 08 09:58:28 2000 +0000 +++ b/src/tparam.c Fri Dec 08 09:58:48 2000 +0000 @@ -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 @@ 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++;