aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorKen Raeburn2002-07-15 00:01:34 +0000
committerKen Raeburn2002-07-15 00:01:34 +0000
commitd5db40779d7505244d37476b4f046641f07eea2b (patch)
tree5c8bf4dad41639287e722cb7cbdc0709e47a9e53 /src/fns.c
parent491c2516d32fa8b9ba9422ec142c8925dd82af00 (diff)
downloademacs-d5db40779d7505244d37476b4f046641f07eea2b.tar.gz
emacs-d5db40779d7505244d37476b4f046641f07eea2b.zip
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references left unchanged for now.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c204
1 files changed, 102 insertions, 102 deletions
diff --git a/src/fns.c b/src/fns.c
index 01d368ba3d3..217e97ffd56 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -132,7 +132,7 @@ To get the number of bytes, use `string-bytes'. */)
132 132
133 retry: 133 retry:
134 if (STRINGP (sequence)) 134 if (STRINGP (sequence))
135 XSETFASTINT (val, XSTRING (sequence)->size); 135 XSETFASTINT (val, SCHARS (sequence));
136 else if (VECTORP (sequence)) 136 else if (VECTORP (sequence))
137 XSETFASTINT (val, XVECTOR (sequence)->size); 137 XSETFASTINT (val, XVECTOR (sequence)->size);
138 else if (CHAR_TABLE_P (sequence)) 138 else if (CHAR_TABLE_P (sequence))
@@ -208,7 +208,7 @@ If STRING is a multibyte string, this is greater than the length of STRING. */)
208 Lisp_Object string; 208 Lisp_Object string;
209{ 209{
210 CHECK_STRING (string); 210 CHECK_STRING (string);
211 return make_number (STRING_BYTES (XSTRING (string))); 211 return make_number (SBYTES (string));
212} 212}
213 213
214DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, 214DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
@@ -225,9 +225,9 @@ Symbols are also allowed; their print names are used instead. */)
225 CHECK_STRING (s1); 225 CHECK_STRING (s1);
226 CHECK_STRING (s2); 226 CHECK_STRING (s2);
227 227
228 if (XSTRING (s1)->size != XSTRING (s2)->size 228 if (SCHARS (s1) != SCHARS (s2)
229 || STRING_BYTES (XSTRING (s1)) != STRING_BYTES (XSTRING (s2)) 229 || SBYTES (s1) != SBYTES (s2)
230 || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, STRING_BYTES (XSTRING (s1)))) 230 || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
231 return Qnil; 231 return Qnil;
232 return Qt; 232 return Qt;
233} 233}
@@ -272,11 +272,11 @@ If string STR1 is greater, the value is a positive number N;
272 i1_byte = string_char_to_byte (str1, i1); 272 i1_byte = string_char_to_byte (str1, i1);
273 i2_byte = string_char_to_byte (str2, i2); 273 i2_byte = string_char_to_byte (str2, i2);
274 274
275 end1_char = XSTRING (str1)->size; 275 end1_char = SCHARS (str1);
276 if (! NILP (end1) && end1_char > XINT (end1)) 276 if (! NILP (end1) && end1_char > XINT (end1))
277 end1_char = XINT (end1); 277 end1_char = XINT (end1);
278 278
279 end2_char = XSTRING (str2)->size; 279 end2_char = SCHARS (str2);
280 if (! NILP (end2) && end2_char > XINT (end2)) 280 if (! NILP (end2) && end2_char > XINT (end2))
281 end2_char = XINT (end2); 281 end2_char = XINT (end2);
282 282
@@ -290,7 +290,7 @@ If string STR1 is greater, the value is a positive number N;
290 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); 290 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte);
291 else 291 else
292 { 292 {
293 c1 = XSTRING (str1)->data[i1++]; 293 c1 = SREF (str1, i1++);
294 c1 = unibyte_char_to_multibyte (c1); 294 c1 = unibyte_char_to_multibyte (c1);
295 } 295 }
296 296
@@ -298,7 +298,7 @@ If string STR1 is greater, the value is a positive number N;
298 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte); 298 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte);
299 else 299 else
300 { 300 {
301 c2 = XSTRING (str2)->data[i2++]; 301 c2 = SREF (str2, i2++);
302 c2 = unibyte_char_to_multibyte (c2); 302 c2 = unibyte_char_to_multibyte (c2);
303 } 303 }
304 304
@@ -354,9 +354,9 @@ Symbols are also allowed; their print names are used instead. */)
354 354
355 i1 = i1_byte = i2 = i2_byte = 0; 355 i1 = i1_byte = i2 = i2_byte = 0;
356 356
357 end = XSTRING (s1)->size; 357 end = SCHARS (s1);
358 if (end > XSTRING (s2)->size) 358 if (end > SCHARS (s2))
359 end = XSTRING (s2)->size; 359 end = SCHARS (s2);
360 360
361 while (i1 < end) 361 while (i1 < end)
362 { 362 {
@@ -370,7 +370,7 @@ Symbols are also allowed; their print names are used instead. */)
370 if (c1 != c2) 370 if (c1 != c2)
371 return c1 < c2 ? Qt : Qnil; 371 return c1 < c2 ? Qt : Qnil;
372 } 372 }
373 return i1 < XSTRING (s2)->size ? Qt : Qnil; 373 return i1 < SCHARS (s2) ? Qt : Qnil;
374} 374}
375 375
376static Lisp_Object concat (); 376static Lisp_Object concat ();
@@ -641,11 +641,11 @@ concat (nargs, args, target_type, last_special)
641 if (STRING_MULTIBYTE (this)) 641 if (STRING_MULTIBYTE (this))
642 { 642 {
643 some_multibyte = 1; 643 some_multibyte = 1;
644 result_len_byte += STRING_BYTES (XSTRING (this)); 644 result_len_byte += SBYTES (this);
645 } 645 }
646 else 646 else
647 result_len_byte += count_size_as_multibyte (XSTRING (this)->data, 647 result_len_byte += count_size_as_multibyte (SDATA (this),
648 XSTRING (this)->size); 648 SCHARS (this));
649 } 649 }
650 } 650 }
651 651
@@ -695,17 +695,17 @@ concat (nargs, args, target_type, last_special)
695 if (STRINGP (this) && STRINGP (val) 695 if (STRINGP (this) && STRINGP (val)
696 && STRING_MULTIBYTE (this) == some_multibyte) 696 && STRING_MULTIBYTE (this) == some_multibyte)
697 { 697 {
698 int thislen_byte = STRING_BYTES (XSTRING (this)); 698 int thislen_byte = SBYTES (this);
699 int combined; 699 int combined;
700 700
701 bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte, 701 bcopy (SDATA (this), SDATA (val) + toindex_byte,
702 STRING_BYTES (XSTRING (this))); 702 SBYTES (this));
703 combined = (some_multibyte && toindex_byte > 0 703 combined = (some_multibyte && toindex_byte > 0
704 ? count_combining (XSTRING (val)->data, 704 ? count_combining (SDATA (val),
705 toindex_byte + thislen_byte, 705 toindex_byte + thislen_byte,
706 toindex_byte) 706 toindex_byte)
707 : 0); 707 : 0);
708 if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) 708 if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
709 { 709 {
710 textprops[num_textprops].argnum = argnum; 710 textprops[num_textprops].argnum = argnum;
711 /* We ignore text properties on characters being combined. */ 711 /* We ignore text properties on characters being combined. */
@@ -714,20 +714,20 @@ concat (nargs, args, target_type, last_special)
714 } 714 }
715 toindex_byte += thislen_byte; 715 toindex_byte += thislen_byte;
716 toindex += thisleni - combined; 716 toindex += thisleni - combined;
717 XSTRING (val)->size -= combined; 717 SCHARS (val) -= combined;
718 } 718 }
719 /* Copy a single-byte string to a multibyte string. */ 719 /* Copy a single-byte string to a multibyte string. */
720 else if (STRINGP (this) && STRINGP (val)) 720 else if (STRINGP (this) && STRINGP (val))
721 { 721 {
722 if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) 722 if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
723 { 723 {
724 textprops[num_textprops].argnum = argnum; 724 textprops[num_textprops].argnum = argnum;
725 textprops[num_textprops].from = 0; 725 textprops[num_textprops].from = 0;
726 textprops[num_textprops++].to = toindex; 726 textprops[num_textprops++].to = toindex;
727 } 727 }
728 toindex_byte += copy_text (XSTRING (this)->data, 728 toindex_byte += copy_text (SDATA (this),
729 XSTRING (val)->data + toindex_byte, 729 SDATA (val) + toindex_byte,
730 XSTRING (this)->size, 0, 1); 730 SCHARS (this), 0, 1);
731 toindex += thisleni; 731 toindex += thisleni;
732 } 732 }
733 else 733 else
@@ -755,7 +755,7 @@ concat (nargs, args, target_type, last_special)
755 } 755 }
756 else 756 else
757 { 757 {
758 XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); 758 XSETFASTINT (elt, SREF (this, thisindex++));
759 if (some_multibyte 759 if (some_multibyte
760 && (XINT (elt) >= 0240 760 && (XINT (elt) >= 0240
761 || (XINT (elt) >= 0200 761 || (XINT (elt) >= 0200
@@ -797,14 +797,14 @@ concat (nargs, args, target_type, last_special)
797 if (some_multibyte) 797 if (some_multibyte)
798 toindex_byte 798 toindex_byte
799 += CHAR_STRING (XINT (elt), 799 += CHAR_STRING (XINT (elt),
800 XSTRING (val)->data + toindex_byte); 800 SDATA (val) + toindex_byte);
801 else 801 else
802 XSTRING (val)->data[toindex_byte++] = XINT (elt); 802 SREF (val, toindex_byte++) = XINT (elt);
803 if (some_multibyte 803 if (some_multibyte
804 && toindex_byte > 0 804 && toindex_byte > 0
805 && count_combining (XSTRING (val)->data, 805 && count_combining (SDATA (val),
806 toindex_byte, toindex_byte - 1)) 806 toindex_byte, toindex_byte - 1))
807 XSTRING (val)->size--; 807 SCHARS (val)--;
808 else 808 else
809 toindex++; 809 toindex++;
810 } 810 }
@@ -815,7 +815,7 @@ concat (nargs, args, target_type, last_special)
815 int c = XINT (elt); 815 int c = XINT (elt);
816 /* P exists as a variable 816 /* P exists as a variable
817 to avoid a bug on the Masscomp C compiler. */ 817 to avoid a bug on the Masscomp C compiler. */
818 unsigned char *p = & XSTRING (val)->data[toindex_byte]; 818 unsigned char *p = & SREF (val, toindex_byte);
819 819
820 toindex_byte += CHAR_STRING (c, p); 820 toindex_byte += CHAR_STRING (c, p);
821 toindex++; 821 toindex++;
@@ -836,7 +836,7 @@ concat (nargs, args, target_type, last_special)
836 this = args[textprops[argnum].argnum]; 836 this = args[textprops[argnum].argnum];
837 props = text_property_list (this, 837 props = text_property_list (this,
838 make_number (0), 838 make_number (0),
839 make_number (XSTRING (this)->size), 839 make_number (SCHARS (this)),
840 Qnil); 840 Qnil);
841 /* If successive arguments have properites, be sure that the 841 /* If successive arguments have properites, be sure that the
842 value of `composition' property be the copy. */ 842 value of `composition' property be the copy. */
@@ -844,7 +844,7 @@ concat (nargs, args, target_type, last_special)
844 make_composition_value_copy (props); 844 make_composition_value_copy (props);
845 add_text_properties_from_list (val, props, 845 add_text_properties_from_list (val, props,
846 make_number (textprops[argnum].to)); 846 make_number (textprops[argnum].to));
847 last_to_end = textprops[argnum].to + XSTRING (this)->size; 847 last_to_end = textprops[argnum].to + SCHARS (this);
848 } 848 }
849 } 849 }
850 return val; 850 return val;
@@ -875,8 +875,8 @@ string_char_to_byte (string, char_index)
875 return char_index; 875 return char_index;
876 876
877 best_below = best_below_byte = 0; 877 best_below = best_below_byte = 0;
878 best_above = XSTRING (string)->size; 878 best_above = SCHARS (string);
879 best_above_byte = STRING_BYTES (XSTRING (string)); 879 best_above_byte = SBYTES (string);
880 880
881 if (EQ (string, string_char_byte_cache_string)) 881 if (EQ (string, string_char_byte_cache_string))
882 { 882 {
@@ -907,7 +907,7 @@ string_char_to_byte (string, char_index)
907 { 907 {
908 while (best_above > char_index) 908 while (best_above > char_index)
909 { 909 {
910 unsigned char *pend = XSTRING (string)->data + best_above_byte; 910 unsigned char *pend = SDATA (string) + best_above_byte;
911 unsigned char *pbeg = pend - best_above_byte; 911 unsigned char *pbeg = pend - best_above_byte;
912 unsigned char *p = pend - 1; 912 unsigned char *p = pend - 1;
913 int bytes; 913 int bytes;
@@ -948,8 +948,8 @@ string_byte_to_char (string, byte_index)
948 return byte_index; 948 return byte_index;
949 949
950 best_below = best_below_byte = 0; 950 best_below = best_below_byte = 0;
951 best_above = XSTRING (string)->size; 951 best_above = SCHARS (string);
952 best_above_byte = STRING_BYTES (XSTRING (string)); 952 best_above_byte = SBYTES (string);
953 953
954 if (EQ (string, string_char_byte_cache_string)) 954 if (EQ (string, string_char_byte_cache_string))
955 { 955 {
@@ -980,7 +980,7 @@ string_byte_to_char (string, byte_index)
980 { 980 {
981 while (best_above_byte > byte_index) 981 while (best_above_byte > byte_index)
982 { 982 {
983 unsigned char *pend = XSTRING (string)->data + best_above_byte; 983 unsigned char *pend = SDATA (string) + best_above_byte;
984 unsigned char *pbeg = pend - best_above_byte; 984 unsigned char *pbeg = pend - best_above_byte;
985 unsigned char *p = pend - 1; 985 unsigned char *p = pend - 1;
986 int bytes; 986 int bytes;
@@ -1020,18 +1020,18 @@ string_make_multibyte (string)
1020 if (STRING_MULTIBYTE (string)) 1020 if (STRING_MULTIBYTE (string))
1021 return string; 1021 return string;
1022 1022
1023 nbytes = count_size_as_multibyte (XSTRING (string)->data, 1023 nbytes = count_size_as_multibyte (SDATA (string),
1024 XSTRING (string)->size); 1024 SCHARS (string));
1025 /* If all the chars are ASCII, they won't need any more bytes 1025 /* If all the chars are ASCII, they won't need any more bytes
1026 once converted. In that case, we can return STRING itself. */ 1026 once converted. In that case, we can return STRING itself. */
1027 if (nbytes == STRING_BYTES (XSTRING (string))) 1027 if (nbytes == SBYTES (string))
1028 return string; 1028 return string;
1029 1029
1030 buf = (unsigned char *) alloca (nbytes); 1030 buf = (unsigned char *) alloca (nbytes);
1031 copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), 1031 copy_text (SDATA (string), buf, SBYTES (string),
1032 0, 1); 1032 0, 1);
1033 1033
1034 return make_multibyte_string (buf, XSTRING (string)->size, nbytes); 1034 return make_multibyte_string (buf, SCHARS (string), nbytes);
1035} 1035}
1036 1036
1037/* Convert STRING to a single-byte string. */ 1037/* Convert STRING to a single-byte string. */
@@ -1045,12 +1045,12 @@ string_make_unibyte (string)
1045 if (! STRING_MULTIBYTE (string)) 1045 if (! STRING_MULTIBYTE (string))
1046 return string; 1046 return string;
1047 1047
1048 buf = (unsigned char *) alloca (XSTRING (string)->size); 1048 buf = (unsigned char *) alloca (SCHARS (string));
1049 1049
1050 copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), 1050 copy_text (SDATA (string), buf, SBYTES (string),
1051 1, 0); 1051 1, 0);
1052 1052
1053 return make_unibyte_string (buf, XSTRING (string)->size); 1053 return make_unibyte_string (buf, SCHARS (string));
1054} 1054}
1055 1055
1056DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, 1056DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte,
@@ -1096,10 +1096,10 @@ corresponding single byte. */)
1096 1096
1097 if (STRING_MULTIBYTE (string)) 1097 if (STRING_MULTIBYTE (string))
1098 { 1098 {
1099 int bytes = STRING_BYTES (XSTRING (string)); 1099 int bytes = SBYTES (string);
1100 unsigned char *str = (unsigned char *) xmalloc (bytes); 1100 unsigned char *str = (unsigned char *) xmalloc (bytes);
1101 1101
1102 bcopy (XSTRING (string)->data, str, bytes); 1102 bcopy (SDATA (string), str, bytes);
1103 bytes = str_as_unibyte (str, bytes); 1103 bytes = str_as_unibyte (str, bytes);
1104 string = make_unibyte_string (str, bytes); 1104 string = make_unibyte_string (str, bytes);
1105 xfree (str); 1105 xfree (str);
@@ -1125,17 +1125,17 @@ multibyte character of charset `eight-bit-control' or `eight-bit-graphic'. */)
1125 Lisp_Object new_string; 1125 Lisp_Object new_string;
1126 int nchars, nbytes; 1126 int nchars, nbytes;
1127 1127
1128 parse_str_as_multibyte (XSTRING (string)->data, 1128 parse_str_as_multibyte (SDATA (string),
1129 STRING_BYTES (XSTRING (string)), 1129 SBYTES (string),
1130 &nchars, &nbytes); 1130 &nchars, &nbytes);
1131 new_string = make_uninit_multibyte_string (nchars, nbytes); 1131 new_string = make_uninit_multibyte_string (nchars, nbytes);
1132 bcopy (XSTRING (string)->data, XSTRING (new_string)->data, 1132 bcopy (SDATA (string), SDATA (new_string),
1133 STRING_BYTES (XSTRING (string))); 1133 SBYTES (string));
1134 if (nbytes != STRING_BYTES (XSTRING (string))) 1134 if (nbytes != SBYTES (string))
1135 str_as_multibyte (XSTRING (new_string)->data, nbytes, 1135 str_as_multibyte (SDATA (new_string), nbytes,
1136 STRING_BYTES (XSTRING (string)), NULL); 1136 SBYTES (string), NULL);
1137 string = new_string; 1137 string = new_string;
1138 XSTRING (string)->intervals = NULL_INTERVAL; 1138 STRING_INTERVALS (string) = NULL_INTERVAL;
1139 } 1139 }
1140 return string; 1140 return string;
1141} 1141}
@@ -1190,8 +1190,8 @@ This function allows vectors as well as strings. */)
1190 1190
1191 if (STRINGP (string)) 1191 if (STRINGP (string))
1192 { 1192 {
1193 size = XSTRING (string)->size; 1193 size = SCHARS (string);
1194 size_byte = STRING_BYTES (XSTRING (string)); 1194 size_byte = SBYTES (string);
1195 } 1195 }
1196 else 1196 else
1197 size = XVECTOR (string)->size; 1197 size = XVECTOR (string)->size;
@@ -1225,7 +1225,7 @@ This function allows vectors as well as strings. */)
1225 1225
1226 if (STRINGP (string)) 1226 if (STRINGP (string))
1227 { 1227 {
1228 res = make_specified_string (XSTRING (string)->data + from_byte, 1228 res = make_specified_string (SDATA (string) + from_byte,
1229 to_char - from_char, to_byte - from_byte, 1229 to_char - from_char, to_byte - from_byte,
1230 STRING_MULTIBYTE (string)); 1230 STRING_MULTIBYTE (string));
1231 copy_text_properties (make_number (from_char), make_number (to_char), 1231 copy_text_properties (make_number (from_char), make_number (to_char),
@@ -1257,8 +1257,8 @@ With one argument, just copy STRING without its properties. */)
1257 1257
1258 CHECK_STRING (string); 1258 CHECK_STRING (string);
1259 1259
1260 size = XSTRING (string)->size; 1260 size = SCHARS (string);
1261 size_byte = STRING_BYTES (XSTRING (string)); 1261 size_byte = SBYTES (string);
1262 1262
1263 if (NILP (from)) 1263 if (NILP (from))
1264 from_char = from_byte = 0; 1264 from_char = from_byte = 0;
@@ -1292,7 +1292,7 @@ With one argument, just copy STRING without its properties. */)
1292 args_out_of_range_3 (string, make_number (from_char), 1292 args_out_of_range_3 (string, make_number (from_char),
1293 make_number (to_char)); 1293 make_number (to_char));
1294 1294
1295 return make_specified_string (XSTRING (string)->data + from_byte, 1295 return make_specified_string (SDATA (string) + from_byte,
1296 to_char - from_char, to_byte - from_byte, 1296 to_char - from_char, to_byte - from_byte,
1297 STRING_MULTIBYTE (string)); 1297 STRING_MULTIBYTE (string));
1298} 1298}
@@ -1314,8 +1314,8 @@ substring_both (string, from, from_byte, to, to_byte)
1314 1314
1315 if (STRINGP (string)) 1315 if (STRINGP (string))
1316 { 1316 {
1317 size = XSTRING (string)->size; 1317 size = SCHARS (string);
1318 size_byte = STRING_BYTES (XSTRING (string)); 1318 size_byte = SBYTES (string);
1319 } 1319 }
1320 else 1320 else
1321 size = XVECTOR (string)->size; 1321 size = XVECTOR (string)->size;
@@ -1325,7 +1325,7 @@ substring_both (string, from, from_byte, to, to_byte)
1325 1325
1326 if (STRINGP (string)) 1326 if (STRINGP (string))
1327 { 1327 {
1328 res = make_specified_string (XSTRING (string)->data + from_byte, 1328 res = make_specified_string (SDATA (string) + from_byte,
1329 to - from, to_byte - from_byte, 1329 to - from, to_byte - from_byte,
1330 STRING_MULTIBYTE (string)); 1330 STRING_MULTIBYTE (string));
1331 copy_text_properties (make_number (from), make_number (to), 1331 copy_text_properties (make_number (from), make_number (to),
@@ -1693,18 +1693,18 @@ to be sure of changing the value of `foo'. */)
1693 int c; 1693 int c;
1694 1694
1695 for (i = nchars = nbytes = ibyte = 0; 1695 for (i = nchars = nbytes = ibyte = 0;
1696 i < XSTRING (seq)->size; 1696 i < SCHARS (seq);
1697 ++i, ibyte += cbytes) 1697 ++i, ibyte += cbytes)
1698 { 1698 {
1699 if (STRING_MULTIBYTE (seq)) 1699 if (STRING_MULTIBYTE (seq))
1700 { 1700 {
1701 c = STRING_CHAR (&XSTRING (seq)->data[ibyte], 1701 c = STRING_CHAR (&SREF (seq, ibyte),
1702 STRING_BYTES (XSTRING (seq)) - ibyte); 1702 SBYTES (seq) - ibyte);
1703 cbytes = CHAR_BYTES (c); 1703 cbytes = CHAR_BYTES (c);
1704 } 1704 }
1705 else 1705 else
1706 { 1706 {
1707 c = XSTRING (seq)->data[i]; 1707 c = SREF (seq, i);
1708 cbytes = 1; 1708 cbytes = 1;
1709 } 1709 }
1710 1710
@@ -1715,34 +1715,34 @@ to be sure of changing the value of `foo'. */)
1715 } 1715 }
1716 } 1716 }
1717 1717
1718 if (nchars != XSTRING (seq)->size) 1718 if (nchars != SCHARS (seq))
1719 { 1719 {
1720 Lisp_Object tem; 1720 Lisp_Object tem;
1721 1721
1722 tem = make_uninit_multibyte_string (nchars, nbytes); 1722 tem = make_uninit_multibyte_string (nchars, nbytes);
1723 if (!STRING_MULTIBYTE (seq)) 1723 if (!STRING_MULTIBYTE (seq))
1724 SET_STRING_BYTES (XSTRING (tem), -1); 1724 STRING_SET_UNIBYTE (tem);
1725 1725
1726 for (i = nchars = nbytes = ibyte = 0; 1726 for (i = nchars = nbytes = ibyte = 0;
1727 i < XSTRING (seq)->size; 1727 i < SCHARS (seq);
1728 ++i, ibyte += cbytes) 1728 ++i, ibyte += cbytes)
1729 { 1729 {
1730 if (STRING_MULTIBYTE (seq)) 1730 if (STRING_MULTIBYTE (seq))
1731 { 1731 {
1732 c = STRING_CHAR (&XSTRING (seq)->data[ibyte], 1732 c = STRING_CHAR (&SREF (seq, ibyte),
1733 STRING_BYTES (XSTRING (seq)) - ibyte); 1733 SBYTES (seq) - ibyte);
1734 cbytes = CHAR_BYTES (c); 1734 cbytes = CHAR_BYTES (c);
1735 } 1735 }
1736 else 1736 else
1737 { 1737 {
1738 c = XSTRING (seq)->data[i]; 1738 c = SREF (seq, i);
1739 cbytes = 1; 1739 cbytes = 1;
1740 } 1740 }
1741 1741
1742 if (!INTEGERP (elt) || c != XINT (elt)) 1742 if (!INTEGERP (elt) || c != XINT (elt))
1743 { 1743 {
1744 unsigned char *from = &XSTRING (seq)->data[ibyte]; 1744 unsigned char *from = &SREF (seq, ibyte);
1745 unsigned char *to = &XSTRING (tem)->data[nbytes]; 1745 unsigned char *to = &SREF (tem, nbytes);
1746 EMACS_INT n; 1746 EMACS_INT n;
1747 1747
1748 ++nchars; 1748 ++nchars;
@@ -2176,12 +2176,12 @@ internal_equal (o1, o2, depth)
2176 break; 2176 break;
2177 2177
2178 case Lisp_String: 2178 case Lisp_String:
2179 if (XSTRING (o1)->size != XSTRING (o2)->size) 2179 if (SCHARS (o1) != SCHARS (o2))
2180 return 0; 2180 return 0;
2181 if (STRING_BYTES (XSTRING (o1)) != STRING_BYTES (XSTRING (o2))) 2181 if (SBYTES (o1) != SBYTES (o2))
2182 return 0; 2182 return 0;
2183 if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, 2183 if (bcmp (SDATA (o1), SDATA (o2),
2184 STRING_BYTES (XSTRING (o1)))) 2184 SBYTES (o1)))
2185 return 0; 2185 return 0;
2186 return 1; 2186 return 1;
2187 2187
@@ -2221,15 +2221,15 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2221 } 2221 }
2222 else if (STRINGP (array)) 2222 else if (STRINGP (array))
2223 { 2223 {
2224 register unsigned char *p = XSTRING (array)->data; 2224 register unsigned char *p = SDATA (array);
2225 CHECK_NUMBER (item); 2225 CHECK_NUMBER (item);
2226 charval = XINT (item); 2226 charval = XINT (item);
2227 size = XSTRING (array)->size; 2227 size = SCHARS (array);
2228 if (STRING_MULTIBYTE (array)) 2228 if (STRING_MULTIBYTE (array))
2229 { 2229 {
2230 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2230 unsigned char str[MAX_MULTIBYTE_LENGTH];
2231 int len = CHAR_STRING (charval, str); 2231 int len = CHAR_STRING (charval, str);
2232 int size_byte = STRING_BYTES (XSTRING (array)); 2232 int size_byte = SBYTES (array);
2233 unsigned char *p1 = p, *endp = p + size_byte; 2233 unsigned char *p1 = p, *endp = p + size_byte;
2234 int i; 2234 int i;
2235 2235
@@ -3113,12 +3113,12 @@ is nil, and `use-dialog-box' is non-nil. */)
3113 ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, 3113 ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
3114 Qyes_or_no_p_history, Qnil, 3114 Qyes_or_no_p_history, Qnil,
3115 Qnil)); 3115 Qnil));
3116 if (XSTRING (ans)->size == 3 && !strcmp (XSTRING (ans)->data, "yes")) 3116 if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes"))
3117 { 3117 {
3118 UNGCPRO; 3118 UNGCPRO;
3119 return Qt; 3119 return Qt;
3120 } 3120 }
3121 if (XSTRING (ans)->size == 2 && !strcmp (XSTRING (ans)->data, "no")) 3121 if (SCHARS (ans) == 2 && !strcmp (SDATA (ans), "no"))
3122 { 3122 {
3123 UNGCPRO; 3123 UNGCPRO;
3124 return Qnil; 3124 return Qnil;
@@ -3257,7 +3257,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
3257 of what files are preloaded and when. */ 3257 of what files are preloaded and when. */
3258 if (! NILP (Vpurify_flag)) 3258 if (! NILP (Vpurify_flag))
3259 error ("(require %s) while preparing to dump", 3259 error ("(require %s) while preparing to dump",
3260 XSTRING (SYMBOL_NAME (feature))->data); 3260 SDATA (SYMBOL_NAME (feature)));
3261 3261
3262 /* A certain amount of recursive `require' is legitimate, 3262 /* A certain amount of recursive `require' is legitimate,
3263 but if we require the same feature recursively 3 times, 3263 but if we require the same feature recursively 3 times,
@@ -3271,7 +3271,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
3271 } 3271 }
3272 if (nesting > 2) 3272 if (nesting > 2)
3273 error ("Recursive `require' for feature `%s'", 3273 error ("Recursive `require' for feature `%s'",
3274 XSTRING (SYMBOL_NAME (feature))->data); 3274 SDATA (SYMBOL_NAME (feature)));
3275 3275
3276 /* Update the list for any nested `require's that occur. */ 3276 /* Update the list for any nested `require's that occur. */
3277 record_unwind_protect (require_unwind, require_nesting_list); 3277 record_unwind_protect (require_unwind, require_nesting_list);
@@ -3294,7 +3294,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
3294 tem = Fmemq (feature, Vfeatures); 3294 tem = Fmemq (feature, Vfeatures);
3295 if (NILP (tem)) 3295 if (NILP (tem))
3296 error ("Required feature `%s' was not provided", 3296 error ("Required feature `%s' was not provided",
3297 XSTRING (SYMBOL_NAME (feature))->data); 3297 SDATA (SYMBOL_NAME (feature)));
3298 3298
3299 /* Once loading finishes, don't undo it. */ 3299 /* Once loading finishes, don't undo it. */
3300 Vautoload_queue = Qt; 3300 Vautoload_queue = Qt;
@@ -3557,7 +3557,7 @@ into shorter lines. */)
3557 /* We need to allocate enough room for encoding the text. 3557 /* We need to allocate enough room for encoding the text.
3558 We need 33 1/3% more space, plus a newline every 76 3558 We need 33 1/3% more space, plus a newline every 76
3559 characters, and then we round up. */ 3559 characters, and then we round up. */
3560 length = STRING_BYTES (XSTRING (string)); 3560 length = SBYTES (string);
3561 allength = length + length/3 + 1; 3561 allength = length + length/3 + 1;
3562 allength += allength / MIME_LINE_LENGTH + 1 + 6; 3562 allength += allength / MIME_LINE_LENGTH + 1 + 6;
3563 3563
@@ -3567,7 +3567,7 @@ into shorter lines. */)
3567 else 3567 else
3568 encoded = (char *) xmalloc (allength); 3568 encoded = (char *) xmalloc (allength);
3569 3569
3570 encoded_length = base64_encode_1 (XSTRING (string)->data, 3570 encoded_length = base64_encode_1 (SDATA (string),
3571 encoded, length, NILP (no_line_break), 3571 encoded, length, NILP (no_line_break),
3572 STRING_MULTIBYTE (string)); 3572 STRING_MULTIBYTE (string));
3573 if (encoded_length > allength) 3573 if (encoded_length > allength)
@@ -3760,7 +3760,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
3760 3760
3761 CHECK_STRING (string); 3761 CHECK_STRING (string);
3762 3762
3763 length = STRING_BYTES (XSTRING (string)); 3763 length = SBYTES (string);
3764 /* We need to allocate enough room for decoding the text. */ 3764 /* We need to allocate enough room for decoding the text. */
3765 if (length <= MAX_ALLOCA) 3765 if (length <= MAX_ALLOCA)
3766 decoded = (char *) alloca (length); 3766 decoded = (char *) alloca (length);
@@ -3768,7 +3768,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
3768 decoded = (char *) xmalloc (length); 3768 decoded = (char *) xmalloc (length);
3769 3769
3770 /* The decoded result should be unibyte. */ 3770 /* The decoded result should be unibyte. */
3771 decoded_length = base64_decode_1 (XSTRING (string)->data, decoded, length, 3771 decoded_length = base64_decode_1 (SDATA (string), decoded, length,
3772 0, NULL); 3772 0, NULL);
3773 if (decoded_length > length) 3773 if (decoded_length > length)
3774 abort (); 3774 abort ();
@@ -4772,8 +4772,8 @@ sxhash (obj, depth)
4772 break; 4772 break;
4773 4773
4774 case Lisp_Symbol: 4774 case Lisp_Symbol:
4775 hash = sxhash_string (XSTRING (SYMBOL_NAME (obj))->data, 4775 hash = sxhash_string (SDATA (SYMBOL_NAME (obj)),
4776 XSTRING (SYMBOL_NAME (obj))->size); 4776 SCHARS (SYMBOL_NAME (obj)));
4777 break; 4777 break;
4778 4778
4779 case Lisp_Misc: 4779 case Lisp_Misc:
@@ -4781,7 +4781,7 @@ sxhash (obj, depth)
4781 break; 4781 break;
4782 4782
4783 case Lisp_String: 4783 case Lisp_String:
4784 hash = sxhash_string (XSTRING (obj)->data, XSTRING (obj)->size); 4784 hash = sxhash_string (SDATA (obj), SCHARS (obj));
4785 break; 4785 break;
4786 4786
4787 /* This can be everything from a vector to an overlay. */ 4787 /* This can be everything from a vector to an overlay. */
@@ -5206,8 +5206,8 @@ guesswork fails. Normally, an error is signaled in such case. */)
5206 if (STRING_MULTIBYTE (object)) 5206 if (STRING_MULTIBYTE (object))
5207 object = code_convert_string1 (object, coding_system, Qnil, 1); 5207 object = code_convert_string1 (object, coding_system, Qnil, 1);
5208 5208
5209 size = XSTRING (object)->size; 5209 size = SCHARS (object);
5210 size_byte = STRING_BYTES (XSTRING (object)); 5210 size_byte = SBYTES (object);
5211 5211
5212 if (!NILP (start)) 5212 if (!NILP (start))
5213 { 5213 {
@@ -5339,8 +5339,8 @@ guesswork fails. Normally, an error is signaled in such case. */)
5339 object = code_convert_string1 (object, coding_system, Qnil, 1); 5339 object = code_convert_string1 (object, coding_system, Qnil, 1);
5340 } 5340 }
5341 5341
5342 md5_buffer (XSTRING (object)->data + start_byte, 5342 md5_buffer (SDATA (object) + start_byte,
5343 STRING_BYTES(XSTRING (object)) - (size_byte - end_byte), 5343 SBYTES (object) - (size_byte - end_byte),
5344 digest); 5344 digest);
5345 5345
5346 for (i = 0; i < 16; i++) 5346 for (i = 0; i < 16; i++)