[前][次][番号順一覧][スレッド一覧]

ruby-changes:43396

From: nobu <ko1@a...>
Date: Mon, 20 Jun 2016 20:00:22 +0900 (JST)
Subject: [ruby-changes:43396] nobu:r55470 (trunk): Name USE_NAME_ON_FS constants

nobu	2016-06-20 20:00:17 +0900 (Mon, 20 Jun 2016)

  New Revision: 55470

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55470

  Log:
    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.

  Modified files:
    trunk/dir.c
Index: dir.c
===================================================================
--- dir.c	(revision 55469)
+++ dir.c	(revision 55470)
@@ -83,14 +83,19 @@ char *strchr(char*,char); https://github.com/ruby/ruby/blob/trunk/dir.c#L83
 #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 b https://github.com/ruby/ruby/blob/trunk/dir.c#L1643
     }
     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( https://github.com/ruby/ruby/blob/trunk/dir.c#L1719
 	    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( https://github.com/ruby/ruby/blob/trunk/dir.c#L1774
     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( https://github.com/ruby/ruby/blob/trunk/dir.c#L1878
 		}
 		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( https://github.com/ruby/ruby/blob/trunk/dir.c#L1950
 		    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,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]