X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/2ef9a108812a6ae3c346882b7338742e392deb89..3caf0269dd4c609b8c2bc22b54598c642ba63ed8:/scope.c?ds=sidebyside diff --git a/scope.c b/scope.c index f1d1ccb..78a465b 100644 --- a/scope.c +++ b/scope.c @@ -140,15 +140,19 @@ Perl_markstack_grow(pTHX) void Perl_savestack_grow(pTHX) { - PL_savestack_max = GROW(PL_savestack_max) + 4; - Renew(PL_savestack, PL_savestack_max, ANY); + PL_savestack_max = GROW(PL_savestack_max); + /* Note that we allocate SS_MAXPUSH slots higher than ss_max + * so that SS_ADD_END(), SSGROW() etc can do a simper check */ + Renew(PL_savestack, PL_savestack_max + SS_MAXPUSH, ANY); } void Perl_savestack_grow_cnt(pTHX_ I32 need) { PL_savestack_max = PL_savestack_ix + need; - Renew(PL_savestack, PL_savestack_max, ANY); + /* Note that we allocate SS_MAXPUSH slots higher than ss_max + * so that SS_ADD_END(), SSGROW() etc can do a simper check */ + Renew(PL_savestack, PL_savestack_max + SS_MAXPUSH, ANY); } #undef GROW