ruby-changes:33886
From: nobu <ko1@a...>
Date: Sat, 17 May 2014 10:05:12 +0900 (JST)
Subject: [ruby-changes:33886] nobu:r45967 (trunk): dir.c: fix conditions for ALPHA
nobu 2014-05-17 10:05:06 +0900 (Sat, 17 May 2014) New Revision: 45967 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45967 Log: dir.c: fix conditions for ALPHA * dir.c (has_magic): return ALPHA at alphabetical name regardless FNM_CASEFOLD flag. * dir.c (glob_helper): fix conditions for ALPHA. [ruby-core:61552] [Bug #9648] Modified files: trunk/ChangeLog trunk/dir.c Index: ChangeLog =================================================================== --- ChangeLog (revision 45966) +++ ChangeLog (revision 45967) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat May 17 10:05:05 2014 Nobuyoshi Nakada <nobu@r...> + + * dir.c (has_magic): return ALPHA at alphabetical name regardless + FNM_CASEFOLD flag. + + * dir.c (glob_helper): fix conditions for ALPHA. + [ruby-core:61552] [Bug #9648] + Sat May 17 01:49:27 2014 Nobuyoshi Nakada <nobu@r...> * dir.c (glob_helper): reduce matching at non-mgaical path on Index: dir.c =================================================================== --- dir.c (revision 45966) +++ dir.c (revision 45967) @@ -1094,7 +1094,6 @@ static enum glob_pattern_type https://github.com/ruby/ruby/blob/trunk/dir.c#L1094 has_magic(const char *p, const char *pend, int flags, rb_encoding *enc) { const int escape = !(flags & FNM_NOESCAPE); - const int nocase = flags & FNM_CASEFOLD; int hasalpha = 0; register char c; @@ -1113,7 +1112,7 @@ has_magic(const char *p, const char *pen https://github.com/ruby/ruby/blob/trunk/dir.c#L1112 default: if (ISALPHA(c)) { - if (FNM_SYSCASE || nocase) hasalpha = 1; + hasalpha = 1; } } @@ -1350,9 +1349,11 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L1349 plain = 1; break; case ALPHA: - case MAGICAL: magical = 1; break; + case MAGICAL: + magical = 2; + break; case MATCH_ALL: match_all = 1; break; @@ -1420,7 +1421,7 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L1421 dirp = do_opendir(*path ? path : ".", flags, enc); if (dirp == NULL) { # if FNM_SYSCASE || HAVE_HFS - if (!(magical || recursive) && (errno == EACCES)) { + if ((magical < 2) && !recursive && (errno == EACCES)) { /* no read permission, fallback */ goto literally; } @@ -1533,7 +1534,7 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L1534 copy_beg = copy_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg); if (!copy_beg) return -1; for (cur = beg; cur < end; ++cur) - *copy_end++ = (*cur)->type == PLAIN ? *cur : 0; + *copy_end++ = (*cur)->type <= ALPHA ? *cur : 0; for (cur = copy_beg; cur < copy_end; ++cur) { if (*cur) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/