Mercurial > emacs
diff src/tparam.c @ 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 | 0df8151400b9 |
children | b9ee14ccc0c8 |
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++;