aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-24 11:38:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-24 11:38:21 +0000
commit8b764b1daf3cc3938cc55347a39da34714894bdf (patch)
tree98fb056b820a53faa51f38aedeacd469ff0aed8e /dir.c
parentfa13cb050db8091658007df77f8247ae02442e51 (diff)
downloadruby-8b764b1daf3cc3938cc55347a39da34714894bdf.tar.gz
dir.c: glob performance
* dir.c (glob_make_pattern): restrict searching case-insensitive name from the filesystem to only last part, for the performance. [ruby-core:63591] [ruby-core:63591] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index bc26436114..36e7a5ed69 100644
--- a/dir.c
+++ b/dir.c
@@ -1241,7 +1241,8 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
else {
const char *m = find_dirsep(p, e, flags, enc);
const enum glob_pattern_type magic = has_magic(p, m, flags, enc);
- const enum glob_pattern_type non_magic = (HAVE_HFS || FNM_SYSCASE) ? PLAIN : ALPHA;
+ const enum glob_pattern_type non_magic =
+ ((HAVE_HFS || FNM_SYSCASE) && (m == e || (m+1 == e && *m == '/'))) ? PLAIN : ALPHA;
char *buf;
if (!(FNM_SYSCASE || magic > non_magic) && !recursive && *m) {