summaryrefslogtreecommitdiff
path: root/src/tparam.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-12-08 09:58:48 +0000
committerGerd Moellmann <gerd@gnu.org>2000-12-08 09:58:48 +0000
commitb5e55477b39213d5390d0f6a05afa85e9b05b7ea (patch)
tree51c140a6f37dc06af29ee270cc21eaf937eb4da7 /src/tparam.c
parentee89188f2926b9e651d488dea8841cccc571a1fe (diff)
downloademacs-b5e55477b39213d5390d0f6a05afa85e9b05b7ea.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.c13
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++;