2011-06-16 Paul Eggert <eggert@cs.ucla.edu>
+ * insdel.c, lisp.h (buffer_overflow): New function.
+ (insert_from_buffer_1, replace_range, replace_range_2):
+ * insdel.c (make_gap_larger):
+ * editfns.c (Finsert_char):
+ * fileio.c (Finsert_file_contents): Use it, to normalize wording.
+
* buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed.
2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
else
str[0] = c, len = 1;
if (BUF_BYTES_MAX / len < XINT (count))
- error ("Maximum buffer size would be exceeded");
+ buffer_overflow ();
n = XINT (count) * len;
if (n <= 0)
return Qnil;
platform that allows file sizes greater than the maximum off_t value. */
if (! not_regular
&& ! (0 <= st.st_size && st.st_size <= BUF_BYTES_MAX))
- error ("Maximum buffer size exceeded");
+ buffer_overflow ();
/* Prevent redisplay optimizations. */
current_buffer->clip_changed = 1;
/* Make sure point-max won't overflow after this insertion. */
XSETINT (temp, total);
if (total != XINT (temp))
- error ("Maximum buffer size exceeded");
+ buffer_overflow ();
}
else
/* For a special file, all we can do is guess. */
}
\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
/* 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 ();
GCPRO1 (new);
/* 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)
extern Lisp_Object Qinhibit_modification_hooks;
extern void move_gap (EMACS_INT);
extern void move_gap_both (EMACS_INT, EMACS_INT);
+extern void buffer_overflow (void) NO_RETURN;
extern void make_gap (EMACS_INT);
extern EMACS_INT copy_text (const unsigned char *, unsigned char *,
EMACS_INT, int, int);