Mercurial > emacs
comparison src/regex.c @ 8254:694c4686b446
(re_match_2_internal): Add casts to shut up some compilers.
(FREE_STACK_RETURN): Nest the free inside the return.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 15 Jul 1994 07:48:35 +0000 |
parents | 66a5487be3a7 |
children | f1a7929cee65 |
comparison
equal
deleted
inserted
replaced
8253:e390776e5846 | 8254:694c4686b446 |
---|---|
1491 The `fastmap' and `newline_anchor' fields are neither | 1491 The `fastmap' and `newline_anchor' fields are neither |
1492 examined nor set. */ | 1492 examined nor set. */ |
1493 | 1493 |
1494 /* Return, freeing storage we allocated. */ | 1494 /* Return, freeing storage we allocated. */ |
1495 #define FREE_STACK_RETURN(value) \ | 1495 #define FREE_STACK_RETURN(value) \ |
1496 do \ | 1496 return (free (compile_stack.stack), value) |
1497 { \ | |
1498 free (compile_stack.stack); \ | |
1499 return value; \ | |
1500 } \ | |
1501 while (1) | |
1502 | 1497 |
1503 static reg_errcode_t | 1498 static reg_errcode_t |
1504 regex_compile (pattern, size, syntax, bufp) | 1499 regex_compile (pattern, size, syntax, bufp) |
1505 const char *pattern; | 1500 const char *pattern; |
1506 int size; | 1501 int size; |
4296 register unsigned char c | 4291 register unsigned char c |
4297 = *p2 == (unsigned char) endline ? '\n' : p2[2]; | 4292 = *p2 == (unsigned char) endline ? '\n' : p2[2]; |
4298 #endif | 4293 #endif |
4299 | 4294 |
4300 if ((re_opcode_t) p1[3] == exactn | 4295 if ((re_opcode_t) p1[3] == exactn |
4301 && ! (p2[1] * BYTEWIDTH > p1[4] | 4296 && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] |
4302 && (p2[1 + p1[4] / BYTEWIDTH] | 4297 && (p2[1 + p1[4] / BYTEWIDTH] |
4303 & (1 << (p1[4] % BYTEWIDTH))))) | 4298 & (1 << (p1[4] % BYTEWIDTH))))) |
4304 { | 4299 { |
4305 p[-3] = (unsigned char) pop_failure_jump; | 4300 p[-3] = (unsigned char) pop_failure_jump; |
4306 DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", | 4301 DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", |
4310 else if ((re_opcode_t) p1[3] == charset_not) | 4305 else if ((re_opcode_t) p1[3] == charset_not) |
4311 { | 4306 { |
4312 int idx; | 4307 int idx; |
4313 /* We win if the charset_not inside the loop | 4308 /* We win if the charset_not inside the loop |
4314 lists every character listed in the charset after. */ | 4309 lists every character listed in the charset after. */ |
4315 for (idx = 0; idx < p2[1]; idx++) | 4310 for (idx = 0; idx < (int) p2[1]; idx++) |
4316 if (! (p2[2 + idx] == 0 | 4311 if (! (p2[2 + idx] == 0 |
4317 || (idx < p1[4] | 4312 || (idx < (int) p1[4] |
4318 && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) | 4313 && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) |
4319 break; | 4314 break; |
4320 | 4315 |
4321 if (idx == p2[1]) | 4316 if (idx == p2[1]) |
4322 { | 4317 { |
4327 else if ((re_opcode_t) p1[3] == charset) | 4322 else if ((re_opcode_t) p1[3] == charset) |
4328 { | 4323 { |
4329 int idx; | 4324 int idx; |
4330 /* We win if the charset inside the loop | 4325 /* We win if the charset inside the loop |
4331 has no overlap with the one after the loop. */ | 4326 has no overlap with the one after the loop. */ |
4332 for (idx = 0; idx < p2[1] && idx < p1[4]; idx++) | 4327 for (idx = 0; |
4328 idx < (int) p2[1] && idx < (int) p1[4]; | |
4329 idx++) | |
4333 if ((p2[2 + idx] & p1[5 + idx]) != 0) | 4330 if ((p2[2 + idx] & p1[5 + idx]) != 0) |
4334 break; | 4331 break; |
4335 | 4332 |
4336 if (idx == p2[1] || idx == p1[4]) | 4333 if (idx == p2[1] || idx == p1[4]) |
4337 { | 4334 { |