summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-20 11:00:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-20 11:00:17 +0000
commit65ca6391edd684f1b23750bbcdac7fa3e27b86aa (patch)
tree7a81994a3c6ecb6820181fd2db7381e6a73d3fa1 /dir.c
parenta77ef2c974ce6c1d8e673388088ea193ce446b8a (diff)
Name USE_NAME_ON_FS constants
* dir.c (USE_NAME_ON_FS): name constants. * USE_NAME_ON_FS_REAL_BASENAME: platform dependent APIs to get real basenames. * USE_NAME_ON_FS_BY_FNMATCH: select the matching basename by fnmatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/dir.c b/dir.c
index eb89d23..d1bd2e4 100644
--- a/dir.c
+++ b/dir.c
@@ -83,14 +83,19 @@ char *strchr(char*,char);
#include <sys/attr.h>
#endif
+#define USE_NAME_ON_FS_REAL_BASENAME 1 /* platform dependent APIs to
+ * get real basenames */
+#define USE_NAME_ON_FS_BY_FNMATCH 2 /* select the matching
+ * basename by fnmatch */
+
#ifdef HAVE_GETATTRLIST
-# define USE_NAME_ON_FS 1
+# define USE_NAME_ON_FS USE_NAME_ON_FS_REAL_BASENAME
# define RUP32(size) ((size)+3/4)
# define SIZEUP32(type) RUP32(sizeof(type))
#elif defined _WIN32
-# define USE_NAME_ON_FS 1
+# define USE_NAME_ON_FS USE_NAME_ON_FS_REAL_BASENAME
#elif defined DOSISH
-# define USE_NAME_ON_FS 2 /* by fnmatch */
+# define USE_NAME_ON_FS USE_NAME_ON_FS_BY_FNMATCH
#else
# define USE_NAME_ON_FS 0
#endif
@@ -1638,7 +1643,7 @@ replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int f
}
return path;
}
-#elif USE_NAME_ON_FS == 1
+#elif USE_NAME_ON_FS == USE_NAME_ON_FS_REAL_BASENAME
# error not implemented
#endif
@@ -1714,7 +1719,7 @@ glob_helper(
plain = 1;
break;
case ALPHA:
-#if USE_NAME_ON_FS == 1
+#if USE_NAME_ON_FS == USE_NAME_ON_FS_REAL_BASENAME
plain = 1;
#else
magical = 1;
@@ -1769,11 +1774,11 @@ glob_helper(
if (magical || recursive) {
struct dirent *dp;
DIR *dirp;
-# if USE_NAME_ON_FS == 2
+# if USE_NAME_ON_FS == USE_NAME_ON_FS_BY_FNMATCH
char *plainname = 0;
# endif
IF_NORMALIZE_UTF8PATH(int norm_p);
-# if USE_NAME_ON_FS == 2
+# if USE_NAME_ON_FS == USE_NAME_ON_FS_BY_FNMATCH
if (cur + 1 == end && (*cur)->type <= ALPHA) {
plainname = join_path(path, pathlen, dirsep, (*cur)->str, strlen((*cur)->str));
if (!plainname) return -1;
@@ -1873,7 +1878,7 @@ glob_helper(
}
switch (p->type) {
case ALPHA:
-# if USE_NAME_ON_FS == 2
+# if USE_NAME_ON_FS == USE_NAME_ON_FS_BY_FNMATCH
if (plainname) {
*new_end++ = p->next;
break;
@@ -1945,7 +1950,7 @@ glob_helper(
status = -1;
break;
}
-#if USE_NAME_ON_FS == 1
+#if USE_NAME_ON_FS == USE_NAME_ON_FS_REAL_BASENAME
if ((*cur)->type == ALPHA) {
long base = pathlen + (dirsep != 0);
buf = replace_real_basename(buf, base, enc, IF_NORMALIZE_UTF8PATH(1)+0,