diff options
author | Zefram <zefram@fysh.org> | 2010-10-28 22:01:11 +0100 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-28 17:51:44 -0700 |
commit | 3987a177937fb7957caa003cdf4c6dee1bb97f71 (patch) | |
tree | ad6d7e97944a83eb44ed9b79043c206c3dd1c585 | |
parent | 691135482762ce9dc9654f3848979dfe881cceb5 (diff) | |
download | perl-3987a177937fb7957caa003cdf4c6dee1bb97f71.tar.gz |
add SAVEFREECOPHH()
Add the facility for the save stack to free (decrement the refcount of)
a COPHH*.
-rw-r--r-- | ext/XS-APItest/APItest.xs | 4 | ||||
-rw-r--r-- | scope.c | 4 | ||||
-rw-r--r-- | scope.h | 2 | ||||
-rw-r--r-- | sv.c | 4 |
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 @@ -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)); @@ -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) \ @@ -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); |