This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_do_vop(): enhance "avoid sv_catpvn"
authorDavid Mitchell <davem@iabyn.com>
Wed, 9 Nov 2016 11:50:35 +0000 (11:50 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 9 Nov 2016 11:50:35 +0000 (11:50 +0000)
commit392582f8c00033c1199d338baf72f42bbd9ef2dc
treeca69fcdae8da8c99e53d6a035724be11bcb2fb47
parent94a5f6597322b09798789257ed58175d9e7462a7
Perl_do_vop(): enhance "avoid sv_catpvn"

TonyC's recent commit v5.25.6-172-gdc529e6 updated do_vop() to avoid
doing a sv_catpvn() when the left and destination SVs are the same.
As well as being more efficient, it is needed, as a recent change to
sv_catpvn() made it more likely to grow and realloc the buffer, meaning
the copy()'s src buffer had been freed.

This commit represents my parallel attempt to fix the same issue; I'm
replacing Tony's version with mine as it is logically more comprehensive:
it copes with the dest being the same as the right arg as well as the
left, and checks for string pointers being equal rather than sv's being
equal. Neither of these make any difference currently, but they could in
theory (although unlikely) catch some future change in usage.

RT #129995
doop.c