diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-15 23:48:01 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-15 23:48:01 -0700 |
commit | 9956144405558933e130f39fb631b21985fba998 (patch) | |
tree | d70d08c3345ab7bcb9a8166ed02c9705becb0ff1 /src/insdel.c | |
parent | 28177adde9132702ed05b411a12c95f05dc2ba89 (diff) | |
download | emacs-9956144405558933e130f39fb631b21985fba998.tar.gz |
* 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.
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/insdel.c b/src/insdel.c index c0cccc65d6a..875274df8e4 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -391,6 +391,12 @@ adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte, } +void +buffer_overflow (void) +{ + error ("Maximum buffer size exceeded"); +} + /* Make the gap NBYTES_ADDED bytes longer. */ static void @@ -408,7 +414,7 @@ make_gap_larger (EMACS_INT nbytes_added) 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); @@ -1105,7 +1111,7 @@ insert_from_buffer_1 (struct buffer *buf, /* 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 @@ -1350,7 +1356,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object 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 (); GCPRO1 (new); @@ -1495,7 +1501,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte, /* 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) |