Adjust in response to jan.h.d's comments.
[bpt/emacs.git] / src / xdisp.c
index d44e677..b64a2c0 100644 (file)
@@ -10384,17 +10384,14 @@ static void
 store_mode_line_noprop_char (char c)
 {
   /* If output position has reached the end of the allocated buffer,
-     double the buffer's size.  */
+     increase the buffer's size.  */
   if (mode_line_noprop_ptr == mode_line_noprop_buf_end)
     {
       ptrdiff_t len = MODE_LINE_NOPROP_LEN (0);
-      ptrdiff_t new_size;
-
-      if (STRING_BYTES_BOUND / 2 < len)
-       memory_full (SIZE_MAX);
-      new_size = 2 * len;
-      mode_line_noprop_buf = (char *) xrealloc (mode_line_noprop_buf, new_size);
-      mode_line_noprop_buf_end = mode_line_noprop_buf + new_size;
+      ptrdiff_t size = len;
+      mode_line_noprop_buf =
+       xpalloc (mode_line_noprop_buf, &size, 1, STRING_BYTES_BOUND, 1);
+      mode_line_noprop_buf_end = mode_line_noprop_buf + size;
       mode_line_noprop_ptr = mode_line_noprop_buf + len;
     }