aboutsummaryrefslogtreecommitdiffstats
path: root/src/termcap.c
diff options
context:
space:
mode:
authorPaul Eggert2011-08-04 19:15:35 -0700
committerPaul Eggert2011-08-04 19:15:35 -0700
commit0065d05491ce5981ea20896bb26d21dcd31e6769 (patch)
tree13240167319d4a99ab5eacae4a883258eb2d28de /src/termcap.c
parent18ab493650d648ab8dca651ea2698861f926e895 (diff)
downloademacs-0065d05491ce5981ea20896bb26d21dcd31e6769.tar.gz
emacs-0065d05491ce5981ea20896bb26d21dcd31e6769.zip
Adjust in response to jan.h.d's comments.
See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
Diffstat (limited to 'src/termcap.c')
-rw-r--r--src/termcap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/termcap.c b/src/termcap.c
index 791c593c06f..6f24817fa72 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -637,13 +637,10 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
637 { 637 {
638 ptrdiff_t ptr_offset = bufp->ptr - buf; 638 ptrdiff_t ptr_offset = bufp->ptr - buf;
639 ptrdiff_t append_end_offset = append_end - buf; 639 ptrdiff_t append_end_offset = append_end - buf;
640 ptrdiff_t size;
641 if ((min (PTRDIFF_MAX, SIZE_MAX) - 1) / 2 < bufp->size)
642 memory_full (SIZE_MAX);
643 size = 2 * bufp->size;
644 /* Add 1 to size to ensure room for terminating null. */ 640 /* Add 1 to size to ensure room for terminating null. */
645 bufp->beg = buf = (char *) xrealloc (buf, size + 1); 641 ptrdiff_t size = bufp->size + 1;
646 bufp->size = size; 642 bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1);
643 bufp->size = size - 1;
647 bufp->ptr = buf + ptr_offset; 644 bufp->ptr = buf + ptr_offset;
648 append_end = buf + append_end_offset; 645 append_end = buf + append_end_offset;
649 } 646 }