summaryrefslogtreecommitdiff
path: root/hv_func.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-11-30 08:59:01 +0000
committerDavid Mitchell <davem@iabyn.com>2016-11-30 09:11:25 +0000
commit71ca73e5fa9639ac33e9f2e74cd0c32288a5040d (patch)
treeec2a5438f0616680afc75821668a4872ab1823b0 /hv_func.h
parentc707756ebb45d88362c58f12444af0ebe1e24ac1 (diff)
downloadperl-71ca73e5fa9639ac33e9f2e74cd0c32288a5040d.tar.gz
split was leaving PL_sv_undef in unused ary slots
This: @a = split(/-/,"-"); $a[1] = undef; $a[0] = 0; was giving Modification of a read-only value attempted at foo line 3. This is because: 1) unused slots in AvARRAY between AvFILL and AvMAX should always be null; av_clear(), av_extend() etc do this; while av_store(), if storing to a slot N somewhere between AvFILL and AvMAX, doesn't bother to clear between (AvFILL+1)..(N-1) on the assumption that everyone else plays nicely. 2) pp_split() when splitting directly to an array, sometimes over-splits and has to null out the excess elements; 3) Since perl 5.19.4, unused AV slots are now marked with NULL rather than &PL_sv_undef; 4) pp_split was still using &PL_sv_undef; The fault was with (4), and is easily fixed.
Diffstat (limited to 'hv_func.h')
0 files changed, 0 insertions, 0 deletions