summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-01 02:09:18 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-01 02:09:18 (GMT)
commit93f6b2a36ed097cf615606bcc30f69a13c0bc8e6 (patch)
tree78232fbecc058e2dcf52b5491454e53c0e01fe98 /dir.c
parentcf0faa96208c94a5caeda22dcf96a28667093a86 (diff)
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/dir.c b/dir.c
index ab36950..4b83563 100644
--- a/dir.c
+++ b/dir.c
@@ -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