aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.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/data.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/data.c')
-rw-r--r--src/data.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/data.c b/src/data.c
index f2c13dd9749..700395808cc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -311,7 +311,7 @@ interned in the initial obarray. */)
311 Lisp_Object object; 311 Lisp_Object object;
312{ 312{
313 if (SYMBOLP (object) 313 if (SYMBOLP (object)
314 && XSTRING (SYMBOL_NAME (object))->data[0] == ':' 314 && SREF (SYMBOL_NAME (object), 0) == ':'
315 && SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object)) 315 && SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object))
316 return Qt; 316 return Qt;
317 return Qnil; 317 return Qnil;
@@ -873,7 +873,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
873 *XINTFWD (valcontents)->intvar = XINT (newval); 873 *XINTFWD (valcontents)->intvar = XINT (newval);
874 if (*XINTFWD (valcontents)->intvar != XINT (newval)) 874 if (*XINTFWD (valcontents)->intvar != XINT (newval))
875 error ("Value out of range for variable `%s'", 875 error ("Value out of range for variable `%s'",
876 XSTRING (SYMBOL_NAME (symbol))->data); 876 SDATA (SYMBOL_NAME (symbol)));
877 break; 877 break;
878 878
879 case Lisp_Misc_Boolfwd: 879 case Lisp_Misc_Boolfwd:
@@ -891,7 +891,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
891 891
892 type = PER_BUFFER_TYPE (offset); 892 type = PER_BUFFER_TYPE (offset);
893 if (XINT (type) == -1) 893 if (XINT (type) == -1)
894 error ("Variable %s is read-only", XSTRING (SYMBOL_NAME (symbol))->data); 894 error ("Variable %s is read-only", SDATA (SYMBOL_NAME (symbol)));
895 895
896 if (! NILP (type) && ! NILP (newval) 896 if (! NILP (type) && ! NILP (newval)
897 && XTYPE (newval) != XINT (type)) 897 && XTYPE (newval) != XINT (type))
@@ -1447,7 +1447,7 @@ The function `default-value' gets the default value and `set-default' sets it.
1447 1447
1448 valcontents = SYMBOL_VALUE (variable); 1448 valcontents = SYMBOL_VALUE (variable);
1449 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1449 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1450 error ("Symbol %s may not be buffer-local", XSTRING (SYMBOL_NAME (variable))->data); 1450 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1451 1451
1452 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1452 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
1453 return variable; 1453 return variable;
@@ -1500,7 +1500,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1500 1500
1501 valcontents = SYMBOL_VALUE (variable); 1501 valcontents = SYMBOL_VALUE (variable);
1502 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1502 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1503 error ("Symbol %s may not be buffer-local", XSTRING (SYMBOL_NAME (variable))->data); 1503 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1504 1504
1505 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1505 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
1506 { 1506 {
@@ -1643,7 +1643,7 @@ See `modify-frame-parameters'. */)
1643 valcontents = SYMBOL_VALUE (variable); 1643 valcontents = SYMBOL_VALUE (variable);
1644 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents) 1644 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)
1645 || BUFFER_OBJFWDP (valcontents)) 1645 || BUFFER_OBJFWDP (valcontents))
1646 error ("Symbol %s may not be frame-local", XSTRING (SYMBOL_NAME (variable))->data); 1646 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
1647 1647
1648 if (BUFFER_LOCAL_VALUEP (valcontents) 1648 if (BUFFER_LOCAL_VALUEP (valcontents)
1649 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1649 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
@@ -1827,14 +1827,14 @@ or a byte-code object. IDX starts at 0. */)
1827 { 1827 {
1828 int c, idxval_byte; 1828 int c, idxval_byte;
1829 1829
1830 if (idxval < 0 || idxval >= XSTRING (array)->size) 1830 if (idxval < 0 || idxval >= SCHARS (array))
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) XSTRING (array)->data[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 (&XSTRING (array)->data[idxval_byte], 1836 c = STRING_CHAR (&SREF (array, idxval_byte),
1837 STRING_BYTES (XSTRING (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))
@@ -2026,29 +2026,29 @@ IDX starts at 0. */)
2026 int idxval_byte, prev_bytes, new_bytes; 2026 int idxval_byte, prev_bytes, new_bytes;
2027 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; 2027 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
2028 2028
2029 if (idxval < 0 || idxval >= XSTRING (array)->size) 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 = &XSTRING (array)->data[idxval_byte]; 2034 p1 = &SREF (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. */
2040 int nchars = XSTRING (array)->size; 2040 int nchars = SCHARS (array);
2041 int nbytes = STRING_BYTES (XSTRING (array)); 2041 int nbytes = SBYTES (array);
2042 unsigned char *str; 2042 unsigned char *str;
2043 2043
2044 str = (nbytes <= MAX_ALLOCA 2044 str = (nbytes <= MAX_ALLOCA
2045 ? (unsigned char *) alloca (nbytes) 2045 ? (unsigned char *) alloca (nbytes)
2046 : (unsigned char *) xmalloc (nbytes)); 2046 : (unsigned char *) xmalloc (nbytes));
2047 bcopy (XSTRING (array)->data, str, nbytes); 2047 bcopy (SDATA (array), str, nbytes);
2048 allocate_string_data (XSTRING (array), nchars, 2048 allocate_string_data (XSTRING (array), nchars,
2049 nbytes + new_bytes - prev_bytes); 2049 nbytes + new_bytes - prev_bytes);
2050 bcopy (str, XSTRING (array)->data, idxval_byte); 2050 bcopy (str, SDATA (array), idxval_byte);
2051 p1 = XSTRING (array)->data + idxval_byte; 2051 p1 = SDATA (array) + idxval_byte;
2052 bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, 2052 bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
2053 nbytes - (idxval_byte + prev_bytes)); 2053 nbytes - (idxval_byte + prev_bytes));
2054 if (nbytes > MAX_ALLOCA) 2054 if (nbytes > MAX_ALLOCA)
@@ -2060,36 +2060,36 @@ IDX starts at 0. */)
2060 } 2060 }
2061 else 2061 else
2062 { 2062 {
2063 if (idxval < 0 || idxval >= XSTRING (array)->size) 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 XSTRING (array)->data[idxval] = XINT (newelt); 2068 SREF (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;
2074 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; 2074 unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
2075 unsigned char *origstr = XSTRING (array)->data, *str; 2075 unsigned char *origstr = SDATA (array), *str;
2076 int nchars, nbytes; 2076 int nchars, nbytes;
2077 2077
2078 nchars = XSTRING (array)->size; 2078 nchars = SCHARS (array);
2079 nbytes = idxval_byte = count_size_as_multibyte (origstr, idxval); 2079 nbytes = idxval_byte = count_size_as_multibyte (origstr, idxval);
2080 nbytes += count_size_as_multibyte (origstr + idxval, 2080 nbytes += count_size_as_multibyte (origstr + idxval,
2081 nchars - idxval); 2081 nchars - idxval);
2082 str = (nbytes <= MAX_ALLOCA 2082 str = (nbytes <= MAX_ALLOCA
2083 ? (unsigned char *) alloca (nbytes) 2083 ? (unsigned char *) alloca (nbytes)
2084 : (unsigned char *) xmalloc (nbytes)); 2084 : (unsigned char *) xmalloc (nbytes));
2085 copy_text (XSTRING (array)->data, str, nchars, 0, 1); 2085 copy_text (SDATA (array), str, nchars, 0, 1);
2086 PARSE_MULTIBYTE_SEQ (str + idxval_byte, nbytes - idxval_byte, 2086 PARSE_MULTIBYTE_SEQ (str + idxval_byte, nbytes - idxval_byte,
2087 prev_bytes); 2087 prev_bytes);
2088 new_bytes = CHAR_STRING (XINT (newelt), p0); 2088 new_bytes = CHAR_STRING (XINT (newelt), p0);
2089 allocate_string_data (XSTRING (array), nchars, 2089 allocate_string_data (XSTRING (array), nchars,
2090 nbytes + new_bytes - prev_bytes); 2090 nbytes + new_bytes - prev_bytes);
2091 bcopy (str, XSTRING (array)->data, idxval_byte); 2091 bcopy (str, SDATA (array), idxval_byte);
2092 p1 = XSTRING (array)->data + idxval_byte; 2092 p1 = SDATA (array) + idxval_byte;
2093 while (new_bytes--) 2093 while (new_bytes--)
2094 *p1++ = *p0++; 2094 *p1++ = *p0++;
2095 bcopy (str + idxval_byte + prev_bytes, p1, 2095 bcopy (str + idxval_byte + prev_bytes, p1,
@@ -2339,7 +2339,7 @@ If the base used is not 10, floating point is not recognized. */)
2339 2339
2340 /* Skip any whitespace at the front of the number. Some versions of 2340 /* Skip any whitespace at the front of the number. Some versions of
2341 atoi do this anyway, so we might as well make Emacs lisp consistent. */ 2341 atoi do this anyway, so we might as well make Emacs lisp consistent. */
2342 p = XSTRING (string)->data; 2342 p = SDATA (string);
2343 while (*p == ' ' || *p == '\t') 2343 while (*p == ' ' || *p == '\t')
2344 p++; 2344 p++;
2345 2345