]> git.vpit.fr Git - perl/modules/autovivification.git/commitdiff
Delete exists/delete ops from the map when the pragma isn't in use
authorVincent Pit <vince@profvince.com>
Tue, 16 Jun 2009 10:17:27 +0000 (12:17 +0200)
committerVincent Pit <vince@profvince.com>
Tue, 16 Jun 2009 10:17:27 +0000 (12:17 +0200)
autovivification.xs

index 2669f3ca42b79ab9e1c8cc31ca7737b2585f0ede..9e10bb5a9f00dd089321c6646f5c54580dd35f88 100644 (file)
@@ -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;
 }