comparison src/data.c @ 46422:50a2414d96b7

* data.c (Faref): Use SDATA. (Faset): Use SDATA, SSET.
author Ken Raeburn <raeburn@raeburn.org>
date Tue, 16 Jul 2002 15:49:07 +0000
parents 40db0673e6f0
children 84a08db3c1e6
comparison
equal deleted inserted replaced
46421:eb8a43bcef9b 46422:50a2414d96b7
1831 args_out_of_range (array, idx); 1831 args_out_of_range (array, idx);
1832 if (! STRING_MULTIBYTE (array)) 1832 if (! STRING_MULTIBYTE (array))
1833 return make_number ((unsigned char) SREF (array, idxval)); 1833 return make_number ((unsigned char) SREF (array, idxval));
1834 idxval_byte = string_char_to_byte (array, idxval); 1834 idxval_byte = string_char_to_byte (array, idxval);
1835 1835
1836 c = STRING_CHAR (&SREF (array, idxval_byte), 1836 c = STRING_CHAR (SDATA (array) + idxval_byte,
1837 SBYTES (array) - idxval_byte); 1837 SBYTES (array) - idxval_byte);
1838 return make_number (c); 1838 return make_number (c);
1839 } 1839 }
1840 else if (BOOL_VECTOR_P (array)) 1840 else if (BOOL_VECTOR_P (array))
1841 { 1841 {
2029 if (idxval < 0 || idxval >= SCHARS (array)) 2029 if (idxval < 0 || idxval >= SCHARS (array))
2030 args_out_of_range (array, idx); 2030 args_out_of_range (array, idx);
2031 CHECK_NUMBER (newelt); 2031 CHECK_NUMBER (newelt);
2032 2032
2033 idxval_byte = string_char_to_byte (array, idxval); 2033 idxval_byte = string_char_to_byte (array, idxval);
2034 p1 = &SREF (array, idxval_byte); 2034 p1 = SDATA (array) + idxval_byte;
2035 PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes); 2035 PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes);
2036 new_bytes = CHAR_STRING (XINT (newelt), p0); 2036 new_bytes = CHAR_STRING (XINT (newelt), p0);
2037 if (prev_bytes != new_bytes) 2037 if (prev_bytes != new_bytes)
2038 { 2038 {
2039 /* We must relocate the string data. */ 2039 /* We must relocate the string data. */
2063 if (idxval < 0 || idxval >= SCHARS (array)) 2063 if (idxval < 0 || idxval >= SCHARS (array))
2064 args_out_of_range (array, idx); 2064 args_out_of_range (array, idx);
2065 CHECK_NUMBER (newelt); 2065 CHECK_NUMBER (newelt);
2066 2066
2067 if (XINT (newelt) < 0 || SINGLE_BYTE_CHAR_P (XINT (newelt))) 2067 if (XINT (newelt) < 0 || SINGLE_BYTE_CHAR_P (XINT (newelt)))
2068 SREF (array, idxval) = XINT (newelt); 2068 SSET (array, idxval, XINT (newelt));
2069 else 2069 else
2070 { 2070 {
2071 /* We must relocate the string data while converting it to 2071 /* We must relocate the string data while converting it to
2072 multibyte. */ 2072 multibyte. */
2073 int idxval_byte, prev_bytes, new_bytes; 2073 int idxval_byte, prev_bytes, new_bytes;