From 28cd8e1dfd44684db52b0c0d0ceafbe8b1be8d4e Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Wed, 20 Oct 2010 11:21:45 +0200 Subject: 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. --- ext/File-Glob/Glob.pm | 6 ------ ext/File-Glob/Glob.xs | 16 +++++++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'ext/File-Glob') 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 -- cgit v1.2.1