diff options
author | Mark Whitley <markw@lineo.com> | 2000-05-01 22:08:54 +0000 |
---|---|---|
committer | Mark Whitley <markw@lineo.com> | 2000-05-01 22:08:54 +0000 |
commit | d16665810d5adc14429fdd7146af356c069e18ad (patch) | |
tree | 5103b7abe46d913118062027c5e709c9591ec0cf | |
parent | 12d1b378bedf682c77755290fb73f0b0d940579a (diff) | |
download | busybox-w32-d16665810d5adc14429fdd7146af356c069e18ad.tar.gz busybox-w32-d16665810d5adc14429fdd7146af356c069e18ad.tar.bz2 busybox-w32-d16665810d5adc14429fdd7146af356c069e18ad.zip |
Minor source modifications to improve readability.
-rw-r--r-- | regexp.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -353,14 +353,11 @@ static int match1(regexp * re, char ch, int token, int ignoreCase) | |||
353 | if (token == M_ANY) { | 353 | if (token == M_ANY) { |
354 | return 0; | 354 | return 0; |
355 | } else if (IS_CLASS(token)) { | 355 | } else if (IS_CLASS(token)) { |
356 | if (re-> | 356 | if (re->program[1 + 32 * (token - M_CLASS(0)) + (ch >> 3)] & (1 << (ch & 7))) |
357 | program[1 + 32 * (token - M_CLASS(0)) + | ||
358 | (ch >> 3)] & (1 << (ch & 7))) | ||
359 | return 0; | 357 | return 0; |
360 | } | 358 | } |
361 | //fprintf(stderr, "match1: ch='%c' token='%c': ", ch, token); | 359 | //fprintf(stderr, "match1: ch='%c' token='%c': ", ch, token); |
362 | if (ch == token | 360 | if (ch == token || (ignoreCase == TRUE && tolower(ch) == tolower(token))) { |
363 | || (ignoreCase == TRUE && tolower(ch) == tolower(token))) { | ||
364 | //fprintf(stderr, "match\n"); | 361 | //fprintf(stderr, "match\n"); |
365 | return 0; | 362 | return 0; |
366 | } | 363 | } |
@@ -532,16 +529,15 @@ extern regexp *regcomp(char *text) | |||
532 | retext = text; | 529 | retext = text; |
533 | for (token = M_START(0), peek = gettoken(&text, re); | 530 | for (token = M_START(0), peek = gettoken(&text, re); |
534 | token; token = peek, peek = gettoken(&text, re)) { | 531 | token; token = peek, peek = gettoken(&text, re)) { |
532 | |||
535 | /* special processing for the closure operator */ | 533 | /* special processing for the closure operator */ |
536 | if (IS_CLOSURE(peek)) { | 534 | if (IS_CLOSURE(peek)) { |
535 | |||
537 | /* detect misuse of closure operator */ | 536 | /* detect misuse of closure operator */ |
538 | if (IS_START(token)) { | 537 | if (IS_START(token)) { |
539 | FAIL("* or \\+ or \\? follows nothing"); | 538 | FAIL("* or \\+ or \\? follows nothing"); |
540 | } | 539 | } else if (IS_META(token) && token != M_ANY && !IS_CLASS(token)) { |
541 | else if (IS_META(token) && token != M_ANY | 540 | FAIL("* or \\+ or \\? can only follow a normal character or . or []"); |
542 | && !IS_CLASS(token)) { | ||
543 | FAIL | ||
544 | ("* or \\+ or \\? can only follow a normal character or . or []"); | ||
545 | } | 541 | } |
546 | 542 | ||
547 | /* it is okay -- make it prefix instead of postfix */ | 543 | /* it is okay -- make it prefix instead of postfix */ |