* buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed.
[bpt/emacs.git] / src / insdel.c
index 5ecb01c..c0cccc6 100644 (file)
@@ -20,6 +20,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <setjmp.h>
+
+#include <intprops.h>
+
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"
@@ -404,11 +407,7 @@ make_gap_larger (EMACS_INT nbytes_added)
   { EMACS_INT total_size = Z_BYTE - BEG_BYTE + GAP_SIZE + 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))
-       /* Don't allow a buffer size that won't fit in an int
-          even if it will fit in a Lisp integer.
-          That won't work because so many places still use `int'.  */
-       || total_size != (EMACS_INT) (int) total_size)
+       || total_size != XINT (make_number (total_size)))
       error ("Buffer exceeds maximum size");
   }
 
@@ -571,32 +570,6 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
       return to_addr - initial_to_addr;
     }
 }
-
-/* Return the number of bytes it would take
-   to convert some single-byte text to multibyte.
-   The single-byte text consists of NBYTES bytes at PTR.  */
-
-EMACS_INT
-count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
-{
-  EMACS_INT i;
-  EMACS_INT outgoing_nbytes = 0;
-
-  for (i = 0; i < nbytes; i++)
-    {
-      unsigned int c = *ptr++;
-
-      if (ASCII_CHAR_P (c))
-       outgoing_nbytes++;
-      else
-       {
-         c = BYTE8_TO_CHAR (c);
-         outgoing_nbytes += CHAR_BYTES (c);
-       }
-    }
-
-  return outgoing_nbytes;
-}
 \f
 /* Insert a string of specified length before point.
    This function judges multibyteness based on