aboutsummaryrefslogtreecommitdiffstats
path: root/src/termcap.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-08 09:58:04 +0000
committerGerd Moellmann2000-12-08 09:58:04 +0000
commit49484b283f663916883a4fcc4b33d4453f0403e4 (patch)
treed5873482ecc4459a31aeefc958c8a43475f244fd /src/termcap.c
parent58d2b9863b1ef9bc95be089ca8def335fd4c481e (diff)
downloademacs-49484b283f663916883a4fcc4b33d4453f0403e4.tar.gz
emacs-49484b283f663916883a4fcc4b33d4453f0403e4.zip
(tgetent): Change the way buffers are reallocated to
be portable and less obfuscated.
Diffstat (limited to 'src/termcap.c')
-rw-r--r--src/termcap.c10
1 files 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)
555 /* If BP is malloc'd by us, make sure it is big enough. */ 555 /* If BP is malloc'd by us, make sure it is big enough. */
556 if (malloc_size) 556 if (malloc_size)
557 { 557 {
558 malloc_size = bp1 - bp + buf.size; 558 int offset1 = bp1 - bp, offset2 = tc_search_point - bp;
559 termcap_name = (char *) xrealloc (bp, malloc_size); 559 malloc_size = offset1 + buf.size;
560 bp1 += termcap_name - bp; 560 bp = termcap_name = (char *) xrealloc (bp, malloc_size);
561 tc_search_point += termcap_name - bp; 561 bp1 = termcap_name + offset1;
562 bp = termcap_name; 562 tc_search_point = termcap_name + offset2;
563 } 563 }
564 564
565 /* Copy the line of the entry from buf into bp. */ 565 /* Copy the line of the entry from buf into bp. */