From: Nicholas Clark Date: Fri, 24 Feb 2006 19:32:11 +0000 (+0000) Subject: Avoid special case SvMAGIC macros just to cope with Perl_sv_unmagic. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=064cf52948e2ac0b1b809d55fe1b456a0b0fa4c4;p=p5sagit%2Fp5-mst-13.2.git Avoid special case SvMAGIC macros just to cope with Perl_sv_unmagic. p4raw-id: //depot/perl@27319 --- diff --git a/sv.c b/sv.c index 3ef19cf..462dc9e 100644 --- a/sv.c +++ b/sv.c @@ -4573,7 +4573,7 @@ Perl_sv_unmagic(pTHX_ SV *sv, int type) MAGIC** mgp; if (SvTYPE(sv) < SVt_PVMG || !SvMAGIC(sv)) return 0; - mgp = &SvMAGIC(sv); + mgp = &(((XPVMG*) SvANY(sv))->xmg_u.xmg_magic); for (mg = *mgp; mg; mg = *mgp) { if (mg->mg_type == type) { const MGVTBL* const vtbl = mg->mg_virtual; diff --git a/sv.h b/sv.h index b4926c0..102c790 100644 --- a/sv.h +++ b/sv.h @@ -990,20 +990,11 @@ in gv.h: */ # define SvEND(sv) ((sv)->sv_u.svu_pv + ((XPV*)SvANY(sv))->xpv_cur) # ifdef DEBUGGING -# ifdef PERL_IN_SV_C -/* Can't make this RVALUE because of Perl_sv_unmagic. */ -# define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_u.xmg_magic)) -# else -# define SvMAGIC(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_u.xmg_magic)) -# endif -# define SvSTASH(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_stash)) +# define SvMAGIC(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_u.xmg_magic)) +# define SvSTASH(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_stash)) # else -# ifdef PERL_IN_SV_C -# define SvMAGIC(sv) ((XPVMG*) SvANY(sv))->xmg_u.xmg_magic -# else -# define SvMAGIC(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_u.xmg_magic) -# endif -# define SvSTASH(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_stash) +# define SvMAGIC(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_u.xmg_magic) +# define SvSTASH(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_stash) # endif #else # define SvPVX(sv) ((sv)->sv_u.svu_pv)