summaryrefslogtreecommitdiff
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
parentfa13cb050db8091658007df77f8247ae02442e51 (diff)
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
-rw-r--r--ChangeLog6
-rw-r--r--dir.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 00dacb7e99..4540eec368 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Dec 24 20:38:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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]
+
Wed Dec 24 18:21:27 2014 Koichi Sasada <ko1@atdot.net>
* gc.c: remove unused rb_objspace_t::rgengc::old_objects_at_gc_start.
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) {