diff options
author | ache <ache@FreeBSD.org> | 1997-06-07 01:33:10 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-06-07 01:33:10 +0000 |
commit | 093956d0d4afe268c9113da9f84c22d843b9e750 (patch) | |
tree | 4f0a82cfcb3985eedb9fa40b9cf2a095cf0c3935 /lib | |
parent | ba9d1da049a48568b2b158479e2105fbaef54cb8 (diff) | |
download | FreeBSD-src-093956d0d4afe268c9113da9f84c22d843b9e750.zip FreeBSD-src-093956d0d4afe268c9113da9f84c22d843b9e750.tar.gz |
Style optimization in newly added POSIX range []] conformance, redo
'for' loop as do...while and remove variable unneded now
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/fnmatch.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index 542a528..c3312b4 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/fnmatch.c @@ -170,11 +170,9 @@ rangematch(pattern, test, flags, newp) int flags; char **newp; { - int negate, ok, first; + int negate, ok; char c, c2; - first = 1; - /* * A bracket expression starting with an unquoted circumflex * character produces unspecified results (IEEE 1003.2-1992, @@ -193,8 +191,9 @@ rangematch(pattern, test, flags, newp) * itself in a bracket expression if it occurs first in the list. * -- POSIX.2 2.8.3.2 */ - for (ok = 0, c = *pattern++; c != ']' || first; c = *pattern++) { - first = 0; + ok = 0; + c = *pattern++; + do { if (c == '\\' && !(flags & FNM_NOESCAPE)) c = *pattern++; if (c == EOS) @@ -225,7 +224,8 @@ rangematch(pattern, test, flags, newp) ok = 1; } else if (c == test) ok = 1; - } + } while ((c = *pattern++) != ']'); + *newp = (char *)pattern; return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH); } |