XEmacs 21.2.36 "Notos"
[chise/xemacs-chise.git.1] / src / insdel.c
index 0ca849c..520507a 100644 (file)
@@ -200,7 +200,6 @@ Boston, MA 02111-1307, USA.  */
 
 #include <config.h>
 #include "lisp.h"
-#include <limits.h>
 
 #include "buffer.h"
 #include "device.h"
@@ -1195,6 +1194,7 @@ bytind_to_bufpos (struct buffer *buf, Bytind x)
 Bufpos
 get_buffer_pos_char (struct buffer *b, Lisp_Object pos, unsigned int flags)
 {
+  /* Does not GC */
   Bufpos ind;
   Bufpos min_allowed, max_allowed;
 
@@ -1244,6 +1244,7 @@ void
 get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to,
                       Bufpos *from_out, Bufpos *to_out, unsigned int flags)
 {
+  /* Does not GC */
   Bufpos min_allowed, max_allowed;
 
   min_allowed = (flags & GB_ALLOW_PAST_ACCESSIBLE) ?
@@ -3082,6 +3083,13 @@ find_charsets_in_bufbyte_string (unsigned char *charsets, const Bufbyte *str,
   const Bufbyte *strend = str + len;
   memset (charsets, 0, NUM_LEADING_BYTES);
 
+  /* #### SJT doesn't like this. */
+  if (len == 0)
+    {
+      charsets[XCHARSET_LEADING_BYTE (Vcharset_ascii) - 128] = 1;
+      return;
+    }
+
   while (str < strend)
     {
       charsets[CHAR_LEADING_BYTE (charptr_emchar (str)) - 128] = 1;
@@ -3101,6 +3109,14 @@ find_charsets_in_emchar_string (unsigned char *charsets, const Emchar *str,
   int i;
 
   memset (charsets, 0, NUM_LEADING_BYTES);
+
+  /* #### SJT doesn't like this. */
+  if (len == 0)
+    {
+      charsets[XCHARSET_LEADING_BYTE (Vcharset_ascii) - 128] = 1;
+      return;
+    }
+
   for (i = 0; i < len; i++)
     {
       charsets[CHAR_LEADING_BYTE (str[i]) - 128] = 1;