summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/XS-APItest/APItest.xs4
-rw-r--r--scope.c4
-rw-r--r--scope.h2
-rw-r--r--sv.c4
4 files changed, 13 insertions, 1 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 945a89030e..386fda9ab6 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -2065,7 +2065,9 @@ test_cophh()
check_ph(cophh_fetch_pvs(a, "foo_\xc2\x8c", 0));
check_iv(cophh_fetch_pvs(a, "foo_\xd9\xa6", COPHH_KEY_UTF8), 666);
check_ph(cophh_fetch_pvs(a, "foo_\xd9\xa6", 0));
- cophh_free(a);
+ ENTER;
+ SAVEFREECOPHH(a);
+ LEAVE;
#undef check_ph
#undef check_iv
#undef msvpvs
diff --git a/scope.c b/scope.c
index 9c1831cfcc..eb464f91da 100644
--- a/scope.c
+++ b/scope.c
@@ -867,6 +867,10 @@ Perl_leave_scope(pTHX_ I32 base)
ptr = SSPOPPTR;
SvREFCNT_dec(MUTABLE_SV(ptr));
break;
+ case SAVEt_FREECOPHH:
+ ptr = SSPOPPTR;
+ cophh_free((COPHH *)ptr);
+ break;
case SAVEt_MORTALIZESV:
ptr = SSPOPPTR;
sv_2mortal(MUTABLE_SV(ptr));
diff --git a/scope.h b/scope.h
index 6cef09162e..7ebd52a387 100644
--- a/scope.h
+++ b/scope.h
@@ -58,6 +58,7 @@
#define SAVEt_I32_SMALL 47
#define SAVEt_INT_SMALL 48
#define SAVEt_GVSV 49
+#define SAVEt_FREECOPHH 50
#define SAVEf_SETMAGIC 1
#define SAVEf_KEEPOLDELEM 2
@@ -184,6 +185,7 @@ scope has the given name. Name must be a literal string.
#define SAVEGENERICPV(s) save_generic_pvref((char**)&(s))
#define SAVESHAREDPV(s) save_shared_pvref((char**)&(s))
#define SAVESETSVFLAGS(sv,mask,val) save_set_svflags(sv,mask,val)
+#define SAVEFREECOPHH(h) save_pushptr((void *)(h), SAVEt_FREECOPHH)
#define SAVEDELETE(h,k,l) \
save_delete(MUTABLE_HV(h), (char*)(k), (I32)(l))
#define SAVEHDELETE(h,s) \
diff --git a/sv.c b/sv.c
index 4d98e68494..3c13a4658c 100644
--- a/sv.c
+++ b/sv.c
@@ -12209,6 +12209,10 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
else
TOPPTR(nss,ix) = NULL;
break;
+ case SAVEt_FREECOPHH:
+ ptr = POPPTR(ss,ix);
+ TOPPTR(nss,ix) = cophh_copy((COPHH *)ptr);
+ break;
case SAVEt_DELETE:
hv = (const HV *)POPPTR(ss,ix);
TOPPTR(nss,ix) = hv_dup_inc(hv, param);