aboutsummaryrefslogtreecommitdiffstats
path: root/src/insdel.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1995-05-05 03:02:02 +0000
committerRichard M. Stallman <[email protected]>1995-05-05 03:02:02 +0000
commit14f6194bdcdbce5a37fc42545bb275e0d8d28c43 (patch)
treece59af0bc6c525285cfbd278da4a369233a2e556 /src/insdel.c
parent8f4f023fe0082616ba70e0a3b88b964c4c9ef7ae (diff)
(make_gap): Make this new error check also check exceeding VALBITS.
(insert_1): Delete old error test. (min): New macro.
Diffstat (limited to 'src/insdel.c')
-rw-r--r--src/insdel.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 59c789a4e8..0f5668f871 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -25,6 +25,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#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 @@ make_gap (increment)
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 @@ insert_1 (string, length, inherit, prepare)
{
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);