Project

General

Profile

Backport #7911 » fix-fnmatch.patch

grafi (Shunsuke Shimizu), 02/22/2013 07:00 PM

View differences:

dir.new.c 2013-02-22 18:46:08.000000000 +0900
VALUE pattern, path;
VALUE rflags;
int flags;
rb_encoding *enc;
if (rb_scan_args(argc, argv, "21", &pattern, &path, &rflags) == 3)
flags = NUM2INT(rflags);
......
StringValue(pattern);
FilePathStringValue(path);
enc = rb_enc_check(pattern, path);
if (flags & FNM_EXTGLOB) {
struct brace_args args;
......
args.value = path;
args.flags = flags;
if (ruby_brace_expand(RSTRING_PTR(pattern), flags, fnmatch_brace,
(VALUE)&args, rb_enc_get(pattern)) > 0)
(VALUE)&args, enc) > 0)
return Qtrue;
}
else {
if (fnmatch(RSTRING_PTR(pattern), rb_enc_get(pattern), RSTRING_PTR(path),
flags) == 0)
if (fnmatch(RSTRING_PTR(pattern), enc, RSTRING_PTR(path), flags) == 0)
return Qtrue;
}
RB_GC_GUARD(pattern);
    (1-1/1)