Skip to content

Commit b6a3d33

Browse files
pcloudsgitster
authored andcommitted
wildmatch: replace variable 'special' with better named ones
'special' is too generic and is used for two different purposes. Replace it with 'match_slash' to indicate "**" pattern and 'negated' for "[!...]" and "[^...]". Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 889316d commit b6a3d33

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

wildmatch.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
6161
const uchar *pattern = p;
6262

6363
for ( ; (p_ch = *p) != '\0'; text++, p++) {
64-
int matched, special;
64+
int matched, match_slash, negated;
6565
uchar t_ch, prev_ch;
6666
if ((t_ch = *text) == '\0' && p_ch != '*')
6767
return ABORT_ALL;
@@ -103,15 +103,15 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
103103
if (p[0] == '/' &&
104104
dowild(p + 1, text, force_lower_case) == MATCH)
105105
return MATCH;
106-
special = TRUE;
106+
match_slash = TRUE;
107107
} else
108108
return ABORT_MALFORMED;
109109
} else
110-
special = FALSE;
110+
match_slash = FALSE;
111111
if (*p == '\0') {
112112
/* Trailing "**" matches everything. Trailing "*" matches
113113
* only if there are no more slash characters. */
114-
if (!special) {
114+
if (!match_slash) {
115115
if (strchr((char*)text, '/') != NULL)
116116
return NOMATCH;
117117
}
@@ -121,9 +121,9 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
121121
if (t_ch == '\0')
122122
break;
123123
if ((matched = dowild(p, text, force_lower_case)) != NOMATCH) {
124-
if (!special || matched != ABORT_TO_STARSTAR)
124+
if (!match_slash || matched != ABORT_TO_STARSTAR)
125125
return matched;
126-
} else if (!special && t_ch == '/')
126+
} else if (!match_slash && t_ch == '/')
127127
return ABORT_TO_STARSTAR;
128128
t_ch = *++text;
129129
}
@@ -135,8 +135,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
135135
p_ch = NEGATE_CLASS;
136136
#endif
137137
/* Assign literal TRUE/FALSE because of "matched" comparison. */
138-
special = p_ch == NEGATE_CLASS? TRUE : FALSE;
139-
if (special) {
138+
negated = p_ch == NEGATE_CLASS? TRUE : FALSE;
139+
if (negated) {
140140
/* Inverted character class. */
141141
p_ch = *++p;
142142
}
@@ -218,7 +218,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
218218
} else if (t_ch == p_ch)
219219
matched = TRUE;
220220
} while (prev_ch = p_ch, (p_ch = *++p) != ']');
221-
if (matched == special || t_ch == '/')
221+
if (matched == negated || t_ch == '/')
222222
return NOMATCH;
223223
continue;
224224
}

0 commit comments

Comments
 (0)