aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-14 03:23:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-14 03:23:56 +0000
commit00f7db376cb3b0176de738d9f9c172397771fbd8 (patch)
tree9766226a065ac37bcaceeb5fe6bd23353862a6a4 /dir.c
parentb48ef1382f57e4a89a28382f60d09236d328fece (diff)
downloadruby-00f7db376cb3b0176de738d9f9c172397771fbd8.tar.gz
dir.h: direct::d_type
* dir.c (glob_helper): use d_type to reduce lstat system calls. * win32/dir.h (struct direct): add d_type instead of d_isdir and d_isrep. SYMLINKD is unreliable, since the target can be replaced after a link was created. * win32/win32.c (readdir_internal): set d_type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 8e7f1c945b..2a7ffc9909 100644
--- a/dir.c
+++ b/dir.c
@@ -1731,13 +1731,13 @@ glob_helper(
name = buf + pathlen + (dirsep != 0);
if (recursive && dotfile < ((flags & FNM_DOTMATCH) ? 2 : 1)) {
/* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
-#ifndef _WIN32
+#ifndef DT_DIR
if (do_lstat(buf, &st, flags, enc) == 0)
new_isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
else
new_isdir = NO;
#else
- new_isdir = dp->d_isdir ? (!dp->d_isrep ? YES : UNKNOWN) : NO;
+ new_isdir = dp->d_type == DT_DIR ? YES : dp->d_type == DT_LNK ? UNKNOWN : NO;
#endif
}