diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-01 02:09:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-01 02:09:18 +0000 |
commit | 93f6b2a36ed097cf615606bcc30f69a13c0bc8e6 (patch) | |
tree | 78232fbecc058e2dcf52b5491454e53c0e01fe98 | |
parent | cf0faa96208c94a5caeda22dcf96a28667093a86 (diff) | |
download | ruby-93f6b2a36ed097cf615606bcc30f69a13c0bc8e6.tar.gz |
dir.c: reduce indirect arguments
* dir.c (push_glob): remove indirect links of arguments for
trampoline.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dir.c | 27 |
2 files changed, 26 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Wed Apr 1 11:09:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * dir.c (push_glob): remove indirect links of arguments for + trampoline. + Wed Apr 1 09:59:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/fileutils.rb (FileUtils#mv): show the exact target path in @@ -2060,10 +2060,23 @@ ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg, enc); } +struct push_glob_args { + struct glob_args glob; + int flags; +}; + +static int +push_caller(const char *path, VALUE val, void *enc) +{ + struct push_glob_args *arg = (struct push_glob_args *)val; + + return ruby_glob0(path, arg->flags, rb_glob_caller, (VALUE)&arg->glob, enc); +} + static int push_glob(VALUE ary, VALUE str, int flags) { - struct glob_args args; + struct push_glob_args args; rb_encoding *enc = rb_enc_get(str); #ifdef __APPLE__ @@ -2071,16 +2084,18 @@ push_glob(VALUE ary, VALUE str, int flags) #endif if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding(); if (enc == rb_usascii_encoding()) enc = rb_ascii8bit_encoding(); - args.func = push_pattern; - args.value = ary; - args.enc = enc; + flags |= GLOB_VERBOSE; + args.glob.func = push_pattern; + args.glob.value = ary; + args.glob.enc = enc; + args.flags = flags; #ifdef __APPLE__ enc = rb_utf8_encoding(); #endif RB_GC_GUARD(str); - return ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE, - rb_glob_caller, (VALUE)&args, enc); + return ruby_brace_expand(RSTRING_PTR(str), flags, + push_caller, (VALUE)&args, enc); } static VALUE |