X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FStorable%2FStorable.xs;h=24de05f88d24be8cf321a33f33c6a66b8c5ff543;hb=5e137bc214f9c21ed33df8110b67005fb915c4e7;hp=77ee1b79005e3ae49cb179d48b3fca20c72f3c32;hpb=80f4f32792d1ebaf9226204ada09d937bbb0f50b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 77ee1b7..24de05f 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -20,6 +20,7 @@ #if !defined(PERL_VERSION) || PERL_VERSION < 8 #define NEED_load_module #define NEED_vload_module +#define NEED_newCONSTSUB #include "ppport.h" /* handle old perls */ #endif @@ -1681,7 +1682,7 @@ static SV *pkg_fetchmeth( pTHX_ HV *cache, HV *pkg, - char *method) + const char *method) { GV *gv; SV *sv; @@ -1721,7 +1722,7 @@ static void pkg_hide( pTHX_ HV *cache, HV *pkg, - char *method) + const char *method) { const char *hvname = HvNAME_get(pkg); (void) hv_store(cache, @@ -1737,7 +1738,7 @@ static void pkg_uncache( pTHX_ HV *cache, HV *pkg, - char *method) + const char *method) { const char *hvname = HvNAME_get(pkg); (void) hv_delete(cache, hvname, strlen(hvname), G_DISCARD); @@ -1755,7 +1756,7 @@ static SV *pkg_can( pTHX_ HV *cache, HV *pkg, - char *method) + const char *method) { SV **svh; SV *sv; @@ -3433,7 +3434,9 @@ static int sv_type(pTHX_ SV *sv) { switch (SvTYPE(sv)) { case SVt_NULL: +#if PERL_VERSION <= 10 case SVt_IV: +#endif case SVt_NV: /* * No need to check for ROK, that can't be set here since there @@ -3441,7 +3444,11 @@ static int sv_type(pTHX_ SV *sv) */ return svis_SCALAR; case SVt_PV: +#if PERL_VERSION <= 10 case SVt_RV: +#else + case SVt_IV: +#endif case SVt_PVIV: case SVt_PVNV: /* @@ -4443,7 +4450,7 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname) * into the existing design. -- RAM, 17/02/2001 */ - sv_magic(sv, rv, mtype, Nullch, 0); + sv_magic(sv, rv, mtype, (char *)NULL, 0); SvREFCNT_dec(rv); /* Undo refcnt inc from sv_magic() */ return sv; @@ -4496,7 +4503,7 @@ static SV *retrieve_ref(pTHX_ stcxt_t *cxt, const char *cname) if (cname) { /* No need to do anything, as rv will already be PVMG. */ - assert (SvTYPE(rv) >= SVt_RV); + assert (SvTYPE(rv) == SVt_RV || SvTYPE(rv) >= SVt_PV); } else { sv_upgrade(rv, SVt_RV); } @@ -4560,7 +4567,7 @@ static SV *retrieve_overloaded(pTHX_ stcxt_t *cxt, const char *cname) * WARNING: breaks RV encapsulation. */ - sv_upgrade(rv, SVt_RV); + SvUPGRADE(rv, SVt_RV); SvRV_set(rv, sv); /* $rv = \$sv */ SvROK_on(rv); @@ -4640,7 +4647,7 @@ static SV *retrieve_tied_array(pTHX_ stcxt_t *cxt, const char *cname) sv_upgrade(tv, SVt_PVAV); AvREAL_off((AV *)tv); - sv_magic(tv, sv, 'P', Nullch, 0); + sv_magic(tv, sv, 'P', (char *)NULL, 0); SvREFCNT_dec(sv); /* Undo refcnt inc from sv_magic() */ TRACEME(("ok (retrieve_tied_array at 0x%"UVxf")", PTR2UV(tv))); @@ -4668,7 +4675,7 @@ static SV *retrieve_tied_hash(pTHX_ stcxt_t *cxt, const char *cname) return (SV *) 0; /* Failed */ sv_upgrade(tv, SVt_PVHV); - sv_magic(tv, sv, 'P', Nullch, 0); + sv_magic(tv, sv, 'P', (char *)NULL, 0); SvREFCNT_dec(sv); /* Undo refcnt inc from sv_magic() */ TRACEME(("ok (retrieve_tied_hash at 0x%"UVxf")", PTR2UV(tv))); @@ -4700,7 +4707,7 @@ static SV *retrieve_tied_scalar(pTHX_ stcxt_t *cxt, const char *cname) } sv_upgrade(tv, SVt_PVMG); - sv_magic(tv, obj, 'q', Nullch, 0); + sv_magic(tv, obj, 'q', (char *)NULL, 0); if (obj) { /* Undo refcnt inc from sv_magic() */ @@ -4767,7 +4774,7 @@ static SV *retrieve_tied_idx(pTHX_ stcxt_t *cxt, const char *cname) RLEN(idx); /* Retrieve */ sv_upgrade(tv, SVt_PVMG); - sv_magic(tv, sv, 'p', Nullch, idx); + sv_magic(tv, sv, 'p', (char *)NULL, idx); SvREFCNT_dec(sv); /* Undo refcnt inc from sv_magic() */ return tv; @@ -6291,7 +6298,11 @@ static SV *dclone(pTHX_ SV *sv) * Tied elements seem to need special handling. */ - if (SvTYPE(sv) == SVt_PVLV && SvRMAGICAL(sv) && mg_find(sv, 'p')) { + if ((SvTYPE(sv) == SVt_PVLV +#if PERL_VERSION < 8 + || SvTYPE(sv) == SVt_PVMG +#endif + ) && SvRMAGICAL(sv) && mg_find(sv, 'p')) { mg_get(sv); }