mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
dir.c: merge rb_glob2 into rb_glob
* dir.c (rb_glob): merge rb_glob2 which is used only here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c7444bcd3
commit
a44c3bb26f
1 changed files with 9 additions and 20 deletions
29
dir.c
29
dir.c
|
@ -2044,29 +2044,18 @@ rb_glob_caller(const char *path, VALUE a, void *enc)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int
|
||||
rb_glob2(const char *path, int flags,
|
||||
void (*func)(const char *, VALUE, void *), VALUE arg,
|
||||
rb_encoding* enc)
|
||||
{
|
||||
struct glob_args args;
|
||||
|
||||
args.func = func;
|
||||
args.value = arg;
|
||||
args.enc = enc;
|
||||
|
||||
if (flags & FNM_SYSCASE) {
|
||||
rb_warning("Dir.glob() ignores File::FNM_CASEFOLD");
|
||||
}
|
||||
|
||||
return ruby_glob0(path, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args,
|
||||
enc);
|
||||
}
|
||||
|
||||
void
|
||||
rb_glob(const char *path, void (*func)(const char *, VALUE, void *), VALUE arg)
|
||||
{
|
||||
int status = rb_glob2(path, 0, func, arg, rb_ascii8bit_encoding());
|
||||
struct glob_args args;
|
||||
int status;
|
||||
|
||||
args.func = func;
|
||||
args.value = arg;
|
||||
args.enc = rb_ascii8bit_encoding();
|
||||
|
||||
status = ruby_glob0(path, GLOB_VERBOSE, rb_glob_caller, (VALUE)&args,
|
||||
args.enc);
|
||||
if (status) GLOB_JUMP_TAG(status);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue