1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-04-01 02:09:18 +00:00
parent cf0faa9620
commit 93f6b2a36e
2 changed files with 26 additions and 6 deletions

View file

@ -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

27
dir.c
View file

@ -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