diff options
author | Gerd Moellmann <gerd@gnu.org> | 2000-12-08 09:58:48 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2000-12-08 09:58:48 +0000 |
commit | fcc014e9d5a5369930bc324adb5f4189b538de86 (patch) | |
tree | 7bfbf5990c62d06a560114474e6cb7c6e74b23c0 /src/tparam.c | |
parent | 9a8fe38d4e019c90685d973a0de4147eff90460c (diff) | |
download | emacs-fcc014e9d5a5369930bc324adb5f4189b538de86.tar.gz |
(tparam1): Change the way buffers are reallocated to be
portable and less obfuscated.
Diffstat (limited to 'src/tparam.c')
-rw-r--r-- | src/tparam.c | 13 |
1 files 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++; |