changeset 5184:039d9a7f2e6d

Call init_string_ascii_begin() in #'sort*, #'fill, don't be clever. 2010-04-02 Aidan Kehoe <kehoea@parhasard.net> * fns.c (FsortX, Ffill): Don't try to be clever with the ascii_begin string header slot in these function, just call init_string_ascii_begin().
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 02 Apr 2010 12:31:23 +0100
parents f283b08ff0c9
children e785e579b084
files src/ChangeLog src/fns.c
diffstat 2 files changed, 9 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Apr 02 12:21:02 2010 +0100
+++ b/src/ChangeLog	Fri Apr 02 12:31:23 2010 +0100
@@ -1,3 +1,9 @@
+2010-04-02  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* fns.c (FsortX, Ffill):
+	Don't try to be clever with the ascii_begin string header slot in
+	these function, just call init_string_ascii_begin().
+
 2010-04-02  Aidan Kehoe  <kehoea@parhasard.net>
 
 	Avoid build failure, Apple's g++-4.0.1, Mac OS 10.4.
--- a/src/fns.c	Fri Apr 02 12:21:02 2010 +0100
+++ b/src/fns.c	Fri Apr 02 12:31:23 2010 +0100
@@ -2671,8 +2671,6 @@
   else if (STRINGP (sequence))
     {
       Ibyte *strdata = XSTRING_DATA (sequence);
-      Elemcount string_ascii_begin = 0;
-      Ichar ch;
 
       sequence_len = string_char_length (sequence);
 
@@ -2686,24 +2684,10 @@
       CHECK_LISP_WRITEABLE (sequence);
       for (i = 0; i < sequence_len; ++i)
         {
-          ch = XCHAR (sequence_carray[i]);
-          strdata += set_itext_ichar (strdata, ch);
-
-          if (string_ascii_begin <= i)
-            {
-              if (byte_ascii_p (ch))
-                {
-                  string_ascii_begin = i;
-                }
-              else
-                {
-                  string_ascii_begin = MAX_STRING_ASCII_BEGIN;
-                }
-            }
+          strdata += set_itext_ichar (strdata, XCHAR (sequence_carray[i]));
         }
 
-      XSET_STRING_ASCII_BEGIN (sequence, min (string_ascii_begin,
-                                              MAX_STRING_ASCII_BEGIN));
+      init_string_ascii_begin (sequence);
       bump_string_modiff (sequence);
       sledgehammer_check_ascii_begin (sequence);
     }
@@ -3836,10 +3820,7 @@
 	memcpy (p, item_buf, item_bytecount);
       *p = '\0';
 
-      XSET_STRING_ASCII_BEGIN (sequence,
-			       item_bytecount == 1 ?
-			       min (new_bytecount, MAX_STRING_ASCII_BEGIN) :
-			       0);
+      init_string_ascii_begin (sequence);
       bump_string_modiff (sequence);
       sledgehammer_check_ascii_begin (sequence);
     }