mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
dir.c: reduce matching
* dir.c (glob_helper): reduce matching at non-mgaical path on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
17d31216ea
commit
8cb6f21e1a
2 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat May 17 01:49:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_helper): reduce matching at non-mgaical path on
|
||||
Windows.
|
||||
|
||||
Sat May 17 01:49:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_pattern_type): separate names with alphabet but no
|
||||
|
|
18
dir.c
18
dir.c
|
@ -1404,7 +1404,19 @@ glob_helper(
|
|||
if (magical || recursive) {
|
||||
struct dirent *dp;
|
||||
DIR *dirp;
|
||||
# if DOSISH
|
||||
char *plainname = 0;
|
||||
# endif
|
||||
IF_HAVE_HFS(int hfs_p);
|
||||
# if DOSISH
|
||||
if (cur + 1 == end && (*cur)->type <= ALPHA) {
|
||||
plainname = join_path(path, pathlen, dirsep, (*cur)->str, strlen((*cur)->str));
|
||||
if (!plainname) return -1;
|
||||
dirp = do_opendir(plainname, flags, enc);
|
||||
GLOB_FREE(plainname);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
dirp = do_opendir(*path ? path : ".", flags, enc);
|
||||
if (dirp == NULL) {
|
||||
# if FNM_SYSCASE || HAVE_HFS
|
||||
|
@ -1489,6 +1501,12 @@ glob_helper(
|
|||
}
|
||||
switch (p->type) {
|
||||
case ALPHA:
|
||||
# ifdef DOSISH
|
||||
if (plainname) {
|
||||
*new_end++ = p->next;
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
case MAGICAL:
|
||||
if (fnmatch(p->str, enc, name, flags) == 0)
|
||||
*new_end++ = p->next;
|
||||
|
|
Loading…
Add table
Reference in a new issue