}
\f
+void
+buffer_overflow (void)
+{
+ error ("Maximum buffer size exceeded");
+}
+
/* Make the gap NBYTES_ADDED bytes longer. */
static void
if (total_size < 0
/* Don't allow a buffer size that won't fit in a Lisp integer. */
|| total_size != XINT (make_number (total_size)))
- error ("Buffer exceeds maximum size");
+ buffer_overflow ();
}
enlarge_buffer_text (current_buffer, nbytes_added);
/* Make sure point-max won't overflow after this insertion. */
XSETINT (temp, outgoing_nbytes + Z);
if (outgoing_nbytes + Z != XINT (temp))
- error ("Maximum buffer size exceeded");
+ buffer_overflow ();
/* Do this before moving and increasing the gap,
because the before-change hooks might move the gap
= count_size_as_multibyte (SDATA (new), insbytes);
/* Make sure point-max won't overflow after this insertion. */
- XSETINT (temp, Z_BYTE - nbytes_del + insbytes);
- if (Z_BYTE - nbytes_del + insbytes != XINT (temp))
- error ("Maximum buffer size exceeded");
+ XSETINT (temp, Z_BYTE - nbytes_del + outgoing_insbytes);
+ if (Z_BYTE - nbytes_del + outgoing_insbytes != XINT (temp))
+ buffer_overflow ();
GCPRO1 (new);
if (Z - GPT < END_UNCHANGED)
END_UNCHANGED = Z - GPT;
- if (GAP_SIZE < insbytes)
- make_gap (insbytes - GAP_SIZE);
+ if (GAP_SIZE < outgoing_insbytes)
+ make_gap (outgoing_insbytes - GAP_SIZE);
/* Copy the string text into the buffer, perhaps converting
between single-byte and multibyte. */
/* Make sure point-max won't overflow after this insertion. */
XSETINT (temp, Z_BYTE - nbytes_del + insbytes);
if (Z_BYTE - nbytes_del + insbytes != XINT (temp))
- error ("Maximum buffer size exceeded");
+ buffer_overflow ();
/* Make sure the gap is somewhere in or next to what we are deleting. */
if (from > GPT)