From 49484b283f663916883a4fcc4b33d4453f0403e4 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 8 Dec 2000 09:58:04 +0000 Subject: [PATCH] (tgetent): Change the way buffers are reallocated to be portable and less obfuscated. --- src/termcap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/termcap.c b/src/termcap.c index f802704383c..c9bf1a40b52 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -555,11 +555,11 @@ tgetent (bp, name) /* If BP is malloc'd by us, make sure it is big enough. */ if (malloc_size) { - malloc_size = bp1 - bp + buf.size; - termcap_name = (char *) xrealloc (bp, malloc_size); - bp1 += termcap_name - bp; - tc_search_point += termcap_name - bp; - bp = termcap_name; + int offset1 = bp1 - bp, offset2 = tc_search_point - bp; + malloc_size = offset1 + buf.size; + bp = termcap_name = (char *) xrealloc (bp, malloc_size); + bp1 = termcap_name + offset1; + tc_search_point = termcap_name + offset2; } /* Copy the line of the entry from buf into bp. */ -- 2.39.2