ruby-changes:38062
From: nobu <ko1@a...>
Date: Wed, 1 Apr 2015 11:09:36 +0900 (JST)
Subject: [ruby-changes:38062] nobu:r50143 (trunk): dir.c: reduce indirect arguments
nobu 2015-04-01 11:09:18 +0900 (Wed, 01 Apr 2015) New Revision: 50143 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50143 Log: dir.c: reduce indirect arguments * dir.c (push_glob): remove indirect links of arguments for trampoline. Modified files: trunk/ChangeLog trunk/dir.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50142) +++ ChangeLog (revision 50143) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Apr 1 11:09:15 2015 Nobuyoshi Nakada <nobu@r...> + + * dir.c (push_glob): remove indirect links of arguments for + trampoline. + Wed Apr 1 09:59:12 2015 Nobuyoshi Nakada <nobu@r...> * lib/fileutils.rb (FileUtils#mv): show the exact target path in Index: dir.c =================================================================== --- dir.c (revision 50142) +++ dir.c (revision 50143) @@ -2060,10 +2060,23 @@ ruby_brace_glob_with_enc(const char *str https://github.com/ruby/ruby/blob/trunk/dir.c#L2060 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 flag https://github.com/ruby/ruby/blob/trunk/dir.c#L2084 #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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/