Squash COWs in the char* typemap
Some XS modules expect to be able to modify strings passed in as char
pointers. Copy-on-write breaks that ability. So this commit makes
the T_PV typemap uncow mutable COWs when passing them.
const char* is now mapped to the new T_ROPV entry, to avoiding unnec-
essarily slowing it down.
Steffen Müller writes in <
52912E9C.3030403@cpan.org> that the typemap
is not dual-lifed, so it is not necessary to make this 5.16-compati-
ble. However, I had already written the patch, and I think it is good
to keep it possible to drop this typemap into a CPAN distribution.
Any self-respecting C compiler should be able to optimise away the
extra SvIsCOW(t_pv_tmp_sv) == 1 check, so there is no slowdown as a
result of compatibility.