summaryrefslogtreecommitdiff
path: root/XSUB.h
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2002-08-21 12:40:49 +0100
committerhv <hv@crypt.org>2002-08-22 10:46:19 +0000
commit6a31061a02dec2e4339d611e71c8a3daf8c83f4a (patch)
tree27d4275ae21c6c7916186e4bd68a41cbfdd2f034 /XSUB.h
parent3a131abc79a92fd4e158b68f3a4bf7df5b8edc88 (diff)
downloadperl-6a31061a02dec2e4339d611e71c8a3daf8c83f4a.tar.gz
Fix DBM filters
From: "Paul Marquess" <Paul.Marquess@btinternet.com> Message-ID: <AIEAJICLCBDNAAOLLOKLAEHCFEAA.Paul.Marquess@btinternet.com> p4raw-id: //depot/perl@17750
Diffstat (limited to 'XSUB.h')
-rw-r--r--XSUB.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/XSUB.h b/XSUB.h
index 2d1b8edad7..a2826ea194 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -228,6 +228,49 @@ C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">.
# define XS_VERSION_BOOTCHECK
#endif
+/*
+ The DBM_setFilter & DBM_ckFilter macros are only used by
+ the *DB*_File modules
+*/
+
+#define DBM_setFilter(db_type,code) \
+ { \
+ if (db_type) \
+ RETVAL = sv_mortalcopy(db_type) ; \
+ ST(0) = RETVAL ; \
+ if (db_type && (code == &PL_sv_undef)) { \
+ SvREFCNT_dec(db_type) ; \
+ db_type = NULL ; \
+ } \
+ else if (code) { \
+ if (db_type) \
+ sv_setsv(db_type, code) ; \
+ else \
+ db_type = newSVsv(code) ; \
+ } \
+ }
+
+#define DBM_ckFilter(arg,type,name) \
+ if (db->type) { \
+ if (db->filtering) { \
+ croak("recursion detected in %s", name) ; \
+ } \
+ ENTER ; \
+ SAVETMPS ; \
+ SAVEINT(db->filtering) ; \
+ db->filtering = TRUE ; \
+ SAVESPTR(DEFSV) ; \
+ DEFSV = arg ; \
+ SvTEMP_off(arg) ; \
+ PUSHMARK(SP) ; \
+ PUTBACK ; \
+ (void) perl_call_sv(db->type, G_DISCARD); \
+ SPAGAIN ; \
+ PUTBACK ; \
+ FREETMPS ; \
+ LEAVE ; \
+ }
+
#if 1 /* for compatibility */
# define VTBL_sv &PL_vtbl_sv
# define VTBL_env &PL_vtbl_env