summaryrefslogtreecommitdiff
path: root/ext/File-Glob/Glob.xs
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-20 11:21:45 +0200
committerNicholas Clark <nick@ccl4.org>2010-10-21 08:42:20 +0200
commit28cd8e1dfd44684db52b0c0d0ceafbe8b1be8d4e (patch)
treefd24498ae060f5e6eb0a0f5a5b45a12cdc200dd7 /ext/File-Glob/Glob.xs
parent6736a914b824405200c697cf2f2bbc6cf8807fa2 (diff)
downloadperl-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/Glob.xs')
-rw-r--r--ext/File-Glob/Glob.xs16
1 files changed, 11 insertions, 5 deletions
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