changeset 34358:aa3b69684dbf

(tgetent): 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:04 +0000
parents 30d5effa35e9
children 09d0a988515c
files src/termcap.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/termcap.c	Fri Dec 08 00:06:01 2000 +0000
+++ b/src/termcap.c	Fri Dec 08 09:58:04 2000 +0000
@@ -555,11 +555,11 @@
       /* 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.  */