comparison src/fns.c @ 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 2e528066e2fc
children b51c2079ec8e
comparison
equal deleted inserted replaced
5183:f283b08ff0c9 5184:039d9a7f2e6d
2669 c_predicate, predicate, key); 2669 c_predicate, predicate, key);
2670 } 2670 }
2671 else if (STRINGP (sequence)) 2671 else if (STRINGP (sequence))
2672 { 2672 {
2673 Ibyte *strdata = XSTRING_DATA (sequence); 2673 Ibyte *strdata = XSTRING_DATA (sequence);
2674 Elemcount string_ascii_begin = 0;
2675 Ichar ch;
2676 2674
2677 sequence_len = string_char_length (sequence); 2675 sequence_len = string_char_length (sequence);
2678 2676
2679 STRING_DATA_TO_OBJECT_ARRAY (strdata, sequence_carray, i, sequence_len); 2677 STRING_DATA_TO_OBJECT_ARRAY (strdata, sequence_carray, i, sequence_len);
2680 2678
2684 strdata = XSTRING_DATA (sequence); 2682 strdata = XSTRING_DATA (sequence);
2685 2683
2686 CHECK_LISP_WRITEABLE (sequence); 2684 CHECK_LISP_WRITEABLE (sequence);
2687 for (i = 0; i < sequence_len; ++i) 2685 for (i = 0; i < sequence_len; ++i)
2688 { 2686 {
2689 ch = XCHAR (sequence_carray[i]); 2687 strdata += set_itext_ichar (strdata, XCHAR (sequence_carray[i]));
2690 strdata += set_itext_ichar (strdata, ch);
2691
2692 if (string_ascii_begin <= i)
2693 {
2694 if (byte_ascii_p (ch))
2695 {
2696 string_ascii_begin = i;
2697 }
2698 else
2699 {
2700 string_ascii_begin = MAX_STRING_ASCII_BEGIN;
2701 }
2702 }
2703 } 2688 }
2704 2689
2705 XSET_STRING_ASCII_BEGIN (sequence, min (string_ascii_begin, 2690 init_string_ascii_begin (sequence);
2706 MAX_STRING_ASCII_BEGIN));
2707 bump_string_modiff (sequence); 2691 bump_string_modiff (sequence);
2708 sledgehammer_check_ascii_begin (sequence); 2692 sledgehammer_check_ascii_begin (sequence);
2709 } 2693 }
2710 else if (BIT_VECTORP (sequence)) 2694 else if (BIT_VECTORP (sequence))
2711 { 2695 {
3834 3818
3835 for (; p < pend; p += item_bytecount) 3819 for (; p < pend; p += item_bytecount)
3836 memcpy (p, item_buf, item_bytecount); 3820 memcpy (p, item_buf, item_bytecount);
3837 *p = '\0'; 3821 *p = '\0';
3838 3822
3839 XSET_STRING_ASCII_BEGIN (sequence, 3823 init_string_ascii_begin (sequence);
3840 item_bytecount == 1 ?
3841 min (new_bytecount, MAX_STRING_ASCII_BEGIN) :
3842 0);
3843 bump_string_modiff (sequence); 3824 bump_string_modiff (sequence);
3844 sledgehammer_check_ascii_begin (sequence); 3825 sledgehammer_check_ascii_begin (sequence);
3845 } 3826 }
3846 else if (VECTORP (sequence)) 3827 else if (VECTORP (sequence))
3847 { 3828 {