changeset 11703:3c5b974e1c10

(make_gap): Make this new error check also check exceeding VALBITS. (insert_1): Delete old error test. (min): New macro.
author Richard M. Stallman <rms@gnu.org>
date Fri, 05 May 1995 03:02:02 +0000
parents afad0099d14b
children 6c9716b7a23d
files src/insdel.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/insdel.c	Fri May 05 03:00:07 1995 +0000
+++ b/src/insdel.c	Fri May 05 03:02:02 1995 +0000
@@ -25,6 +25,8 @@
 #include "window.h"
 #include "blockinput.h"
 
+#define min(x, y) ((x) < (y) ? (x) : (y))
+
 static void insert_from_string_1 ();
 static void insert_from_buffer_1 ();
 static void gap_left ();
@@ -275,9 +277,9 @@
      even if it will fit in a Lisp integer.
      That won't work because so many places use `int'.  */
      
-  if (VALBITS > INTBITS
-      && (Z - BEG + GAP_SIZE + increment) >= ((unsigned) 1 << (INTBITS - 1)))
-    error ("Buffer too big");
+  if (Z - BEG + GAP_SIZE + increment
+      >= ((unsigned) 1 << (min (INTBITS, VALBITS) - 1)))
+    error ("Buffer exceeds maximum size");
 
   BLOCK_INPUT;
   result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment));
@@ -350,11 +352,6 @@
 {
   register Lisp_Object temp;
 
-  /* Make sure point-max won't overflow after this insertion.  */
-  XSETINT (temp, length + Z);
-  if (length + Z != XINT (temp))
-    error ("maximum buffer size exceeded");
-
   if (prepare)
     prepare_to_modify_buffer (PT, PT);