Commit 41596d63 authored by Daniel Dragan's avatar Daniel Dragan Committed by Dominic Hargreaves

improve SvPV_set's docs, it really shouldn't be public API

Someone else in the perl community wrote XS code using SvPV_set instead
of sv_setpvn and couldn't figure out why he was getting
heap corruption/failed asserts/SEGVs/etc. Improve the docs to basically say
never use this.
(cherry picked from commit f2979eac0a03fcba1cd431ef3d46f697176ebcc8)

Bug-Debian: https://bugs.debian.org/822336
Patch-Name: fixes/5.20.3/docs/SvPV_set.diff
parent 5f365e51
......@@ -792,13 +792,18 @@ C<SvIV_set> instead of the lvalue assignment to C<SvIVX>.
Set the value of the NV pointer in sv to val. See C<SvIV_set>.
=for apidoc Am|void|SvPV_set|SV* sv|char* val
Set the value of the PV pointer in C<sv> to the C<NUL>-terminated string
C<val>. See also C<SvIV_set>.
This is probably not what you want to use, you probably wanted
L</sv_usepvn_flags> or L</sv_setpvn> or L</sv_setpvs>.
Set the value of the PV pointer in C<sv> to the Perl allocated
C<NUL>-terminated string C<val>. See also C<SvIV_set>.
Remember to free the previous PV buffer. There are many things to check.
Beware that the existing pointer may be involved in copy-on-write or other
mischief, so do C<SvOOK_off(sv)> and use C<sv_force_normal> or
C<SvPV_force> (or check the SvIsCOW flag) first to make sure this
modification is safe.
modification is safe. Then finally, if it is not a COW, call C<SvPV_free> to
free the previous PV buffer.
=for apidoc Am|void|SvUV_set|SV* sv|UV val
Set the value of the UV pointer in sv to val. See C<SvIV_set>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment