1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

dir.c: adjust indent [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-22 04:06:23 +00:00
parent 6888d69747
commit 7fa932ece6

93
dir.c
View file

@ -355,55 +355,56 @@ fnmatch_helper(
goto failed; goto failed;
} }
case '{': if (flags & FNM_EXTGLOB) { case '{':
size_t len = pend - p; if (flags & FNM_EXTGLOB) {
char *buf = FNMATCH_ALLOC_N(char, len); size_t len = pend - p;
const char *rbrace = NULL; char *buf = FNMATCH_ALLOC_N(char, len);
while (p < pend) { const char *rbrace = NULL;
const char *t = ++p; while (p < pend) {
int nest = 0; const char *t = ++p;
while (p < pend && !(*p == ',' && nest == 0)) { int nest = 0;
if (*p == '{') nest++; while (p < pend && !(*p == ',' && nest == 0)) {
if (*p == '}') { if (*p == '{') nest++;
if (nest == 0) { if (*p == '}') {
if (!rbrace) rbrace = p; if (nest == 0) {
goto rest; if (!rbrace) rbrace = p;
} goto rest;
nest--;
}
if (*p == '\\' && escape) {
if (++p >= pend) break;
}
Inc(p, pend, enc);
} }
if (!rbrace) { nest--;
rbrace = p;
while (rbrace < pend && !(*rbrace == '}' && nest == 0)) {
if (*rbrace == '{') nest++;
if (*rbrace == '}') nest--;
if (*rbrace == '\\' && escape) {
if (++p >= pend) break;
}
Inc(rbrace, pend, enc);
}
}
rest:
memcpy(buf, t, p-t);
buf[p-t]=0;
strlcpy(buf+(p-t), rbrace+1, len-(p-t));
{
const char *pp = buf, *ss = s;
r = fnmatch_helper((const char **)&pp, &ss, flags|FNM_DOTMATCH, enc);
}
if (r == 0) {
p = buf;
FNMATCH_FREE(buf);
RETURN(0);
}
if (p >= rbrace) break;
} }
FNMATCH_FREE(buf); if (*p == '\\' && escape) {
if (++p >= pend) break;
}
Inc(p, pend, enc);
} }
if (!rbrace) {
rbrace = p;
while (rbrace < pend && !(*rbrace == '}' && nest == 0)) {
if (*rbrace == '{') nest++;
if (*rbrace == '}') nest--;
if (*rbrace == '\\' && escape) {
if (++p >= pend) break;
}
Inc(rbrace, pend, enc);
}
}
rest:
memcpy(buf, t, p-t);
buf[p-t]=0;
strlcpy(buf+(p-t), rbrace+1, len-(p-t));
{
const char *pp = buf, *ss = s;
r = fnmatch_helper((const char **)&pp, &ss, flags|FNM_DOTMATCH, enc);
}
if (r == 0) {
p = buf;
FNMATCH_FREE(buf);
RETURN(0);
}
if (p >= rbrace) break;
}
FNMATCH_FREE(buf);
}
} }
/* ordinary */ /* ordinary */