summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/APItest.xs
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-11-09 10:40:40 +0000
committerNicholas Clark <nick@ccl4.org>2010-11-09 10:40:40 +0000
commite89bfaa62e9e0ba9df6482deee1c3a10abd743fb (patch)
tree01e3628f53ed9cdb99e367f946715cbb3a08aa53 /ext/XS-APItest/APItest.xs
parentcf21866aa5d4778ecb4afa98d45353e8b67addeb (diff)
downloadperl-e89bfaa62e9e0ba9df6482deee1c3a10abd743fb.tar.gz
Fix error in tryAMAGICunDEREF() introduced in 25a9ffce153b0e67.
tryAMAGICunDEREF() isn't used anywhere in the core. Add tests for it.
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r--ext/XS-APItest/APItest.xs33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 3bad3286f2..23dd9637c6 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -923,6 +923,39 @@ amagic_deref_call(sv, what)
/* The reference is owned by something else. */
PUSHs(amagic_deref_call(sv, what));
+# I'd certainly like to discourage the use of this macro, given that we now
+# have amagic_deref_call
+
+SV *
+tryAMAGICunDEREF_var(sv, what)
+ SV *sv
+ int what
+ PPCODE:
+ {
+ SV **sp = &sv;
+ switch(what) {
+ case to_av_amg:
+ tryAMAGICunDEREF(to_av);
+ break;
+ case to_cv_amg:
+ tryAMAGICunDEREF(to_cv);
+ break;
+ case to_gv_amg:
+ tryAMAGICunDEREF(to_gv);
+ break;
+ case to_hv_amg:
+ tryAMAGICunDEREF(to_hv);
+ break;
+ case to_sv_amg:
+ tryAMAGICunDEREF(to_sv);
+ break;
+ default:
+ croak("Invalid value %d passed to tryAMAGICunDEREF_var", what);
+ }
+ }
+ /* The reference is owned by something else. */
+ PUSHs(sv);
+
MODULE = XS::APItest PACKAGE = XS::APItest::XSUB
BOOT: