Skip to content

Commit 0883837

Browse files
committed
chore(fnmatch.c): resolved SonarQube issues
Signed-off-by: Spago123 <harun.spago.code@gmail.com>
1 parent dd6ce78 commit 0883837

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/posix/options/fnmatch.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,9 @@ static bool match_posix_class(const char **pattern, int test) {
119119
p++;
120120
for (size_t i = 0; i < sizeof(classes)/sizeof(classes[0]); i++) {
121121
size_t len = strlen(classes[i].name);
122-
if (strncmp(p, classes[i].name, len) == 0 && p[len] == ':') {
123-
if (p[len+1] == ']') {
124-
*pattern = p + len + 2; // move past ":]"
122+
if (strncmp(p, classes[i].name, len) == 0 && p[len] == ':' && p[len+1] == ']') {
123+
*pattern = p + len + 2; /* move past ":]" */
125124
return classes[i].func(test);
126-
}
127125
}
128126
}
129127
return false;
@@ -173,9 +171,15 @@ static const char *rangematch(const char *pattern, int test, int flags)
173171
ok = true;
174172
continue;
175173
} else {
176-
// skip over class if unrecognized
177-
while (*pattern && !(*pattern == ':' && *(pattern+1) == ']')) pattern++;
178-
if (*pattern) pattern += 2;
174+
/* skip over class if unrecognized */
175+
while (*pattern && !(*pattern == ':' && *(pattern+1) == ']')) {
176+
pattern++;
177+
}
178+
179+
if (*pattern)
180+
{
181+
pattern += 2;
182+
}
179183
continue;
180184
}
181185
}

0 commit comments

Comments
 (0)