# HG changeset patch # User Richard M. Stallman # Date 799642922 0 # Node ID 3c5b974e1c10f9b4d37371ef520894ac7cf238ff # Parent afad0099d14b436b097c7f94f2bcfd95c030cecb (make_gap): Make this new error check also check exceeding VALBITS. (insert_1): Delete old error test. (min): New macro. diff -r afad0099d14b -r 3c5b974e1c10 src/insdel.c --- 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);