aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorKenichi Handa1998-05-18 04:53:37 +0000
committerKenichi Handa1998-05-18 04:53:37 +0000
commit130901129f0de5bafd30384ace1b797884359ba8 (patch)
tree643192f262bd9dad94f736e0e43b1a65c6d30f5a /src/syntax.c
parent1c9056c31482bed5cb1315e756ee06b9c8980dc9 (diff)
downloademacs-130901129f0de5bafd30384ace1b797884359ba8.tar.gz
emacs-130901129f0de5bafd30384ace1b797884359ba8.zip
(skip_chars): Fix previous change.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 9e15cc4ff43..d043e115565 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1254,6 +1254,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1254 register int i, i_byte; 1254 register int i, i_byte;
1255 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 1255 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
1256 int string_multibyte = STRING_MULTIBYTE (string); 1256 int string_multibyte = STRING_MULTIBYTE (string);
1257 int size_byte = STRING_BYTES (XSTRING (string));
1257 1258
1258 CHECK_STRING (string, 0); 1259 CHECK_STRING (string, 0);
1259 char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2); 1260 char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2);
@@ -1273,7 +1274,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1273 1274
1274 i = 0, i_byte = 0; 1275 i = 0, i_byte = 0;
1275 1276
1276 if (i < XSTRING (string)->size 1277 if (i_byte < size_byte
1277 && XSTRING (string)->data[0] == '^') 1278 && XSTRING (string)->data[0] == '^')
1278 { 1279 {
1279 negate = 1; i++, i_byte++; 1280 negate = 1; i++, i_byte++;
@@ -1283,7 +1284,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1283 If syntaxp, each character counts as itself. 1284 If syntaxp, each character counts as itself.
1284 Otherwise, handle backslashes and ranges specially. */ 1285 Otherwise, handle backslashes and ranges specially. */
1285 1286
1286 while (i < XSTRING (string)->size) 1287 while (i_byte < size_byte)
1287 { 1288 {
1288 int c_leading_code; 1289 int c_leading_code;
1289 1290
@@ -1293,7 +1294,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1293 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); 1294 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte);
1294 } 1295 }
1295 else 1296 else
1296 c = c_leading_code = XSTRING (string)->data[i++]; 1297 c = c_leading_code = XSTRING (string)->data[i_byte++];
1297 1298
1298 /* Convert multibyteness between what the string has 1299 /* Convert multibyteness between what the string has
1299 and what the buffer has. */ 1300 and what the buffer has. */
@@ -1308,18 +1309,18 @@ skip_chars (forwardp, syntaxp, string, lim)
1308 { 1309 {
1309 if (c == '\\') 1310 if (c == '\\')
1310 { 1311 {
1311 if (i == XSTRING (string)->size) 1312 if (i_byte == size_byte)
1312 break; 1313 break;
1313 1314
1314 if (string_multibyte) 1315 if (string_multibyte)
1315 { 1316 {
1316 c_leading_code = XSTRING (string)->data[i]; 1317 c_leading_code = XSTRING (string)->data[i_byte];
1317 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); 1318 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte);
1318 } 1319 }
1319 else 1320 else
1320 c = c_leading_code = XSTRING (string)->data[i++]; 1321 c = c_leading_code = XSTRING (string)->data[i_byte++];
1321 } 1322 }
1322 if (i < XSTRING (string)->size 1323 if (i_byte < size_byte
1323 && XSTRING (string)->data[i_byte] == '-') 1324 && XSTRING (string)->data[i_byte] == '-')
1324 { 1325 {
1325 unsigned int c2, c2_leading_code; 1326 unsigned int c2, c2_leading_code;
@@ -1327,7 +1328,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1327 /* Skip over the dash. */ 1328 /* Skip over the dash. */
1328 i++, i_byte++; 1329 i++, i_byte++;
1329 1330
1330 if (i == XSTRING (string)->size) 1331 if (i_byte == size_byte)
1331 break; 1332 break;
1332 1333
1333 /* Get the end of the range. */ 1334 /* Get the end of the range. */
@@ -1337,7 +1338,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1337 FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte); 1338 FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte);
1338 } 1339 }
1339 else 1340 else
1340 c2 = XSTRING (string)->data[i++]; 1341 c2 = XSTRING (string)->data[i_byte++];
1341 1342
1342 if (SINGLE_BYTE_CHAR_P (c)) 1343 if (SINGLE_BYTE_CHAR_P (c))
1343 { 1344 {