summaryrefslogtreecommitdiff
path: root/src/termcap.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-08-04 19:15:35 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-08-04 19:15:35 -0700
commit0065d05491ce5981ea20896bb26d21dcd31e6769 (patch)
tree13240167319d4a99ab5eacae4a883258eb2d28de /src/termcap.c
parent18ab493650d648ab8dca651ea2698861f926e895 (diff)
downloademacs-0065d05491ce5981ea20896bb26d21dcd31e6769.tar.gz
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)
{
ptrdiff_t ptr_offset = bufp->ptr - buf;
ptrdiff_t append_end_offset = append_end - buf;
- ptrdiff_t size;
- if ((min (PTRDIFF_MAX, SIZE_MAX) - 1) / 2 < bufp->size)
- memory_full (SIZE_MAX);
- size = 2 * bufp->size;
/* Add 1 to size to ensure room for terminating null. */
- bufp->beg = buf = (char *) xrealloc (buf, size + 1);
- bufp->size = size;
+ ptrdiff_t size = bufp->size + 1;
+ bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1);
+ bufp->size = size - 1;
bufp->ptr = buf + ptr_offset;
append_end = buf + append_end_offset;
}