summaryrefslogtreecommitdiffstats
path: root/sys/libkern/fnmatch.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-06-07 01:33:10 +0000
committerache <ache@FreeBSD.org>1997-06-07 01:33:10 +0000
commit093956d0d4afe268c9113da9f84c22d843b9e750 (patch)
tree4f0a82cfcb3985eedb9fa40b9cf2a095cf0c3935 /sys/libkern/fnmatch.c
parentba9d1da049a48568b2b158479e2105fbaef54cb8 (diff)
downloadFreeBSD-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 'sys/libkern/fnmatch.c')
-rw-r--r--sys/libkern/fnmatch.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/libkern/fnmatch.c b/sys/libkern/fnmatch.c
index 542a528..c3312b4 100644
--- a/sys/libkern/fnmatch.c
+++ b/sys/libkern/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);
}
OpenPOWER on IntegriCloud