summaryrefslogtreecommitdiff
path: root/regexp.c
diff options
context:
space:
mode:
authorMark Whitley2000-05-01 22:08:54 +0000
committerMark Whitley2000-05-01 22:08:54 +0000
commitd16665810d5adc14429fdd7146af356c069e18ad (patch)
tree5103b7abe46d913118062027c5e709c9591ec0cf /regexp.c
parent12d1b378bedf682c77755290fb73f0b0d940579a (diff)
downloadbusybox-d16665810d5adc14429fdd7146af356c069e18ad.zip
busybox-d16665810d5adc14429fdd7146af356c069e18ad.tar.gz
Minor source modifications to improve readability.
Diffstat (limited to 'regexp.c')
-rw-r--r--regexp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/regexp.c b/regexp.c
index f4a8aa1..048c03f 100644
--- a/regexp.c
+++ b/regexp.c
@@ -353,14 +353,11 @@ static int match1(regexp * re, char ch, int token, int ignoreCase)
if (token == M_ANY) {
return 0;
} else if (IS_CLASS(token)) {
- if (re->
- program[1 + 32 * (token - M_CLASS(0)) +
- (ch >> 3)] & (1 << (ch & 7)))
+ if (re->program[1 + 32 * (token - M_CLASS(0)) + (ch >> 3)] & (1 << (ch & 7)))
return 0;
}
//fprintf(stderr, "match1: ch='%c' token='%c': ", ch, token);
- if (ch == token
- || (ignoreCase == TRUE && tolower(ch) == tolower(token))) {
+ if (ch == token || (ignoreCase == TRUE && tolower(ch) == tolower(token))) {
//fprintf(stderr, "match\n");
return 0;
}
@@ -532,16 +529,15 @@ extern regexp *regcomp(char *text)
retext = text;
for (token = M_START(0), peek = gettoken(&text, re);
token; token = peek, peek = gettoken(&text, re)) {
+
/* special processing for the closure operator */
if (IS_CLOSURE(peek)) {
+
/* detect misuse of closure operator */
if (IS_START(token)) {
FAIL("* or \\+ or \\? follows nothing");
- }
- else if (IS_META(token) && token != M_ANY
- && !IS_CLASS(token)) {
- FAIL
- ("* or \\+ or \\? can only follow a normal character or . or []");
+ } else if (IS_META(token) && token != M_ANY && !IS_CLASS(token)) {
+ FAIL("* or \\+ or \\? can only follow a normal character or . or []");
}
/* it is okay -- make it prefix instead of postfix */