]> git.vpit.fr Git - perl/modules/Scope-Upper.git/commitdiff
Fix off-by-one error in su_uplevel_ud->si initialization
authorVincent Pit <perl@profvince.com>
Mon, 9 Nov 2015 17:45:27 +0000 (15:45 -0200)
committerVincent Pit <perl@profvince.com>
Mon, 9 Nov 2015 17:45:27 +0000 (15:45 -0200)
si->si_cxmax is the last available context slot, hence should be -1 if we
don't allocate any.

Upper.xs

index e54c013dc160e9affe21c44a8c640846adc0910b..f6ed5c6381bf38df43caf09949a5af0bd104100d 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -384,7 +384,7 @@ static su_uplevel_ud *su_uplevel_ud_new(pTHX) {
  si->si_stack   = newAV();
  AvREAL_off(si->si_stack);
  si->si_cxstack = NULL;
  si->si_stack   = newAV();
  AvREAL_off(si->si_stack);
  si->si_cxstack = NULL;
- si->si_cxmax   = 0;
+ si->si_cxmax   = -1;
 
  sud->si = si;
 
 
  sud->si = si;