diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2022-11-08 23:40:06 +0000 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-11-21 12:40:10 +0100 |
commit | dbf3614df92e720a9536b1cceb915a18ff2b8c08 (patch) | |
tree | 4a024e221c8ca84b8bbb14be28ebd890f7ffd610 /av.c | |
parent | b17e77fbd875a907749400afcdb9da990643edad (diff) | |
download | perl-dbf3614df92e720a9536b1cceb915a18ff2b8c08.tar.gz |
Extract minimum PV buffer/AV element size to common definitions
In a nutshell, for a long time the minimum PV length (hardcoded
in Perl_sv_grow) has been 10 bytes and the minimum AV array size
(hardcoded in av_extend_guts) has been 4 elements.
These numbers have been used elsewhere for consistency (e.g.
Perl_sv_grow_fresh) in the past couple of development cycles.
Having a standard definition, rather than hardcoding in multiple
places, is more maintainable. This commit therefore introduces
into perl.h:
PERL_ARRAY_NEW_MIN_KEY
PERL_STRLEN_NEW_MIN
(Note: Subsequent commit(s) will actually change the values.)
Diffstat (limited to 'av.c')
-rw-r--r-- | av.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -177,7 +177,8 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp, PL_stack_max = PL_stack_base + newmax; } } else { /* there is no SV* array yet */ - *maxp = key < 3 ? 3 : key; + *maxp = key < PERL_ARRAY_NEW_MIN_KEY ? + PERL_ARRAY_NEW_MIN_KEY : key; { /* see comment above about newmax+1*/ MEM_WRAP_CHECK_s(*maxp, SV*, |