develooper Front page | perl.perl5.porters | Postings from February 2021

SvPV in perlapi?

Thread Next
Felipe Gasper
February 16, 2021 21:30
SvPV in perlapi?
Message ID:
Hi all,

I’ve fixed some bugs today that arose from use of SvPV in XS code rather than SvPVbyte. The fixes involved either sending patches upstream or prefixing our XS call with Perl utf8::downgrade() on the strings.

How frequently is SvPV the right choice rather than SvPVbyte or SvPVutf8? It seems … rare … that the C code should want to work on different bytes depending on how Perl stores the string.

If that’s true, should perlapi.pod’s description of SvPV be updated to encourage XS newbies to prefer one of the others instead? e.g., “Unless you care about how Perl stores the string internally, prefer SvPVbyte (for encoded strings) or SvPVutf8 (for decoded strings).”

Thank you!

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About