Mercurial > emacs
changeset 34360:c6d74397e65f
(tparam1): Change the way buffers are reallocated to be
portable and less obfuscated.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 08 Dec 2000 09:58:48 +0000 |
parents | 09d0a988515c |
children | 385981407528 |
files | src/tparam.c |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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++;