diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-20 11:21:45 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-21 08:42:20 +0200 |
commit | 28cd8e1dfd44684db52b0c0d0ceafbe8b1be8d4e (patch) | |
tree | fd24498ae060f5e6eb0a0f5a5b45a12cdc200dd7 /ext/File-Glob | |
parent | 6736a914b824405200c697cf2f2bbc6cf8807fa2 (diff) | |
download | perl-28cd8e1dfd44684db52b0c0d0ceafbe8b1be8d4e.tar.gz |
Convert File::Glob::bsd_glob to XS.
Unlike doglob, it has no prototype, so it's not possible to use a simple ALIAS
directive to make it and doglob aliases.
Diffstat (limited to 'ext/File-Glob')
-rw-r--r-- | ext/File-Glob/Glob.pm | 6 | ||||
-rw-r--r-- | ext/File-Glob/Glob.xs | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm index de2362fa73..eead37899a 100644 --- a/ext/File-Glob/Glob.pm +++ b/ext/File-Glob/Glob.pm @@ -63,12 +63,6 @@ if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) { $DEFAULT_FLAGS |= GLOB_NOCASE(); } -sub bsd_glob { - my ($pat,$flags) = @_; - $flags = $DEFAULT_FLAGS if @_ < 2; - return doglob($pat,$flags); -} - # File::Glob::glob() is deprecated because its prototype is different from # CORE::glob() (use bsd_glob() instead) sub glob { diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs index 30e7f8290a..8543a04d39 100644 --- a/ext/File-Glob/Glob.xs +++ b/ext/File-Glob/Glob.xs @@ -36,11 +36,6 @@ GLOB_ERROR() OUTPUT: RETVAL -BOOT: -{ - MY_CXT_INIT; -} - void doglob(pattern,...) char *pattern @@ -54,10 +49,13 @@ PREINIT: PPCODE: { dMY_CXT; + dXSI32; /* allow for optional flags argument */ if (items > 1) { flags = (int) SvIV(ST(1)); + } else if (ix) { + flags = (int) SvIV(get_sv("File::Glob::DEFAULT_FLAGS", GV_ADD)); } /* call glob */ @@ -78,4 +76,12 @@ PPCODE: bsd_globfree(&pglob); } +BOOT: +{ + CV *cv = newXS("File::Glob::bsd_glob", XS_File__Glob_doglob, __FILE__); + XSANY.any_i32 = 1; + + MY_CXT_INIT; +} + INCLUDE: const-xs.inc |