]> git.vpit.fr Git - perl/modules/Scope-Upper.git/commitdiff
Stop copying the reap-ed coderef
authorVincent Pit <vince@profvince.com>
Mon, 3 Aug 2015 14:03:13 +0000 (11:03 -0300)
committerVincent Pit <vince@profvince.com>
Mon, 3 Aug 2015 14:03:13 +0000 (11:03 -0300)
Upper.xs

index 18ba9865e1190227a595e2e511bcedbd1935f6a1..928fdfd28295a098bdf1fc69cbcf065d787d70df 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -2872,7 +2872,9 @@ CODE:
  cxix = su_context_normalize_down(cxix);
  Newx(ud, 1, su_ud_reap);
  SU_UD_TYPE(ud) = SU_UD_TYPE_REAP;
- ud->cb         = newSVsv(hook);
+ ud->cb         = (SvROK(hook) && SvTYPE(SvRV(hook)) >= SVt_PVCV)
+                  ? SvRV(hook) : hook;
+ SvREFCNT_inc_simple_void(ud->cb);
  su_init(ud, cxix, SU_SAVE_DESTRUCTOR_SIZE);
 
 void