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"
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