summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/APItest.xs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r--ext/XS-APItest/APItest.xs37
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 00fccb3654..ff7667b24a 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -125,8 +125,19 @@ S_myset_set(pTHX_ SV* sv, MAGIC* mg)
return 0;
}
+static int
+S_myset_set_dies(pTHX_ SV* sv, MAGIC* mg)
+{
+ PERL_UNUSED_ARG(sv);
+ PERL_UNUSED_ARG(mg);
+ croak("in S_myset_set_dies");
+ return 0;
+}
+
+
static MGVTBL vtbl_foo, vtbl_bar;
static MGVTBL vtbl_myset = { 0, S_myset_set, 0, 0, 0, 0, 0, 0 };
+static MGVTBL vtbl_myset_dies = { 0, S_myset_set_dies, 0, 0, 0, 0, 0, 0 };
static int
S_mycopy_copy(pTHX_ SV *sv, MAGIC* mg, SV *nsv, const char *name, I32 namlen) {
@@ -4839,6 +4850,13 @@ test_get_vtbl()
# where that magic's job is to increment thingy
void
+sv_magic_myset_dies(SV *rsv, SV *thingy)
+CODE:
+ sv_magicext(SvRV(rsv), NULL, PERL_MAGIC_ext, &vtbl_myset_dies,
+ (const char *)thingy, 0);
+
+
+void
sv_magic_myset(SV *rsv, SV *thingy)
CODE:
sv_magicext(SvRV(rsv), NULL, PERL_MAGIC_ext, &vtbl_myset,
@@ -4863,6 +4881,25 @@ sv_magic_mycopy_count(SV *rsv)
OUTPUT:
RETVAL
+int
+my_av_store(SV *rsv, IV i, SV *sv)
+ CODE:
+ if (av_store((AV*)SvRV(rsv), i, sv)) {
+ SvREFCNT_inc(sv);
+ RETVAL = 1;
+ } else {
+ RETVAL = 0;
+ }
+ OUTPUT:
+ RETVAL
+
+STRLEN
+sv_refcnt(SV *sv)
+ CODE:
+ RETVAL = SvREFCNT(sv);
+ OUTPUT:
+ RETVAL
+
MODULE = XS::APItest PACKAGE = XS::APItest