]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Cleanup indirect_map_clean() recursion
authorVincent Pit <vince@profvince.com>
Wed, 10 Dec 2008 20:27:33 +0000 (21:27 +0100)
committerVincent Pit <vince@profvince.com>
Wed, 10 Dec 2008 20:27:33 +0000 (21:27 +0100)
indirect.xs

index c89c8b9d0080aee0aec716c668885e640674c65c..9acddcdf88b7cc94aea523668fcb05f7291a7aff 100644 (file)
@@ -140,19 +140,23 @@ STATIC void indirect_map_delete(pTHX_ const OP *o) {
  hv_delete(indirect_map, buf, OP2STR(o), G_DISCARD);
 }
 
-STATIC void indirect_map_clean(pTHX_ const OP *o) {
-#define indirect_map_clean(O) indirect_map_clean(aTHX_ (O))
+STATIC void indirect_map_clean_kids(pTHX_ const OP *o) {
+#define indirect_map_clean_kids(O) indirect_map_clean_kids(aTHX_ (O))
  if (o->op_flags & OPf_KIDS) {
   const OP *kid = cUNOPo->op_first;
   for (; kid; kid = kid->op_sibling) {
+   indirect_map_clean_kids(kid);
    indirect_map_delete(kid);
-   indirect_map_clean(kid);
   }
- } else {
-  indirect_map_delete(o);
  }
 }
 
+STATIC void indirect_map_clean(pTHX_ const OP *o) {
+#define indirect_map_clean(O) indirect_map_clean(aTHX_ (O))
+ indirect_map_clean_kids(o);
+ indirect_map_delete(o);
+}
+
 STATIC const char *indirect_find(pTHX_ SV *sv, const char *s) {
 #define indirect_find(N, S) indirect_find(aTHX_ (N), (S))
  STRLEN len;