From: Vincent Pit Date: Tue, 16 Jun 2009 10:17:27 +0000 (+0200) Subject: Delete exists/delete ops from the map when the pragma isn't in use X-Git-Tag: v0.02~9 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fautovivification.git;a=commitdiff_plain;h=0c37aa6a52c733eb61895b9c95054e5e2f689ede Delete exists/delete ops from the map when the pragma isn't in use --- diff --git a/autovivification.xs b/autovivification.xs index 2669f3c..9e10bb5 100644 --- a/autovivification.xs +++ b/autovivification.xs @@ -548,13 +548,16 @@ STATIC OP *a_ck_root(pTHX_ OP *o) { } o = CALL_FPTR(old_ck)(aTHX_ o); - if (enabled) { - a_map_set_root(o, hint | A_HINT_DEREF); - a_map_store(o, o->op_ppaddr, hint); - o->op_ppaddr = a_pp_root; - } else { - a_map_set_root(o, 0); - } + if (hint & A_HINT_DO) { + if (enabled) { + a_map_set_root(o, hint | A_HINT_DEREF); + a_map_store(o, o->op_ppaddr, hint); + o->op_ppaddr = a_pp_root; + } else { + a_map_set_root(o, 0); + } + } else + a_map_delete(o); return o; }