From: Vincent Pit Date: Wed, 26 Oct 2011 20:57:54 +0000 (+0200) Subject: Clean up vmg_uvar_val() a bit X-Git-Tag: v0.47~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=fb63c158ed67d2aa769f142956b649c520341249;p=perl%2Fmodules%2FVariable-Magic.git Clean up vmg_uvar_val() a bit --- diff --git a/Magic.xs b/Magic.xs index 7fee00e..ca90b7f 100644 --- a/Magic.xs +++ b/Magic.xs @@ -1257,9 +1257,9 @@ STATIC I32 vmg_svt_val(pTHX_ IV action, SV *sv) { if (uf[1].uf_set) uf[1].uf_set(aTHX_ action, sv); - action &= HV_FETCH_ISSTORE | HV_FETCH_ISEXISTS | HV_FETCH_LVALUE | HV_DELETE; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { const vmg_wizard *w; + switch (mg->mg_type) { case PERL_MAGIC_ext: break; @@ -1269,8 +1269,11 @@ STATIC I32 vmg_svt_val(pTHX_ IV action, SV *sv) { default: continue; } + w = vmg_wizard_from_mg(mg); - if (!w) continue; + if (!w) + continue; + switch (w->uvar) { case 0: continue; @@ -1278,7 +1281,9 @@ STATIC I32 vmg_svt_val(pTHX_ IV action, SV *sv) { if (!newkey) newkey = key = umg->mg_obj = sv_mortalcopy(umg->mg_obj); } - switch (action) { + + switch (action + & (HV_FETCH_ISSTORE|HV_FETCH_ISEXISTS|HV_FETCH_LVALUE|HV_DELETE)) { case 0: if (w->cb_fetch) vmg_cb_call2(w->cb_fetch, w->opinfo, sv, mg->mg_obj, key);