diff options
| author | Miles Bader | 2003-04-18 01:23:43 +0000 |
|---|---|---|
| committer | Miles Bader | 2003-04-18 01:23:43 +0000 |
| commit | c6464167c6d78835d83ed090aaa5e4dc5e1f520d (patch) | |
| tree | c721b6ad4e436053a8da7788c170e606e3a7a460 /src/data.c | |
| parent | e509f1689ace103dc0860661d599cd25fdb2e766 (diff) | |
| download | emacs-c6464167c6d78835d83ed090aaa5e4dc5e1f520d.tar.gz emacs-c6464167c6d78835d83ed090aaa5e4dc5e1f520d.zip | |
(Faset): Calculate nbytes earlier, to satisfy the now pickier
PARSE_MULTIBYTE_SEQ.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/data.c b/src/data.c index 5b03f0ebff2..b52aff10819 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2029,13 +2029,15 @@ bool-vector. IDX starts at 0. */) | |||
| 2029 | } | 2029 | } |
| 2030 | else if (STRING_MULTIBYTE (array)) | 2030 | else if (STRING_MULTIBYTE (array)) |
| 2031 | { | 2031 | { |
| 2032 | int idxval_byte, prev_bytes, new_bytes; | 2032 | int idxval_byte, prev_bytes, new_bytes, nbytes; |
| 2033 | unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; | 2033 | unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; |
| 2034 | 2034 | ||
| 2035 | if (idxval < 0 || idxval >= SCHARS (array)) | 2035 | if (idxval < 0 || idxval >= SCHARS (array)) |
| 2036 | args_out_of_range (array, idx); | 2036 | args_out_of_range (array, idx); |
| 2037 | CHECK_NUMBER (newelt); | 2037 | CHECK_NUMBER (newelt); |
| 2038 | 2038 | ||
| 2039 | nbytes = SBYTES (array); | ||
| 2040 | |||
| 2039 | idxval_byte = string_char_to_byte (array, idxval); | 2041 | idxval_byte = string_char_to_byte (array, idxval); |
| 2040 | p1 = SDATA (array) + idxval_byte; | 2042 | p1 = SDATA (array) + idxval_byte; |
| 2041 | PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes); | 2043 | PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes); |
| @@ -2044,7 +2046,6 @@ bool-vector. IDX starts at 0. */) | |||
| 2044 | { | 2046 | { |
| 2045 | /* We must relocate the string data. */ | 2047 | /* We must relocate the string data. */ |
| 2046 | int nchars = SCHARS (array); | 2048 | int nchars = SCHARS (array); |
| 2047 | int nbytes = SBYTES (array); | ||
| 2048 | unsigned char *str; | 2049 | unsigned char *str; |
| 2049 | 2050 | ||
| 2050 | str = (nbytes <= MAX_ALLOCA | 2051 | str = (nbytes <= MAX_ALLOCA |