develooper Front page | perl.perl5.porters | Postings from May 2016

[perl #128226] Remove the requirement for null termination on PVs

Thread Next
Father Chrysostomos
May 23, 2016 23:51
[perl #128226] Remove the requirement for null termination on PVs
Message ID:
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #128226]
# in the subject line of all future correspondence about this issue. 
# <URL: >

If we could remove the requirement that PVs in SVs have a terminating null, we could make things like substr() faster (by having it use the same string buffer as the full original string).

Since it is not uncommon in XS code to pass SvPV(...) to a system function that expects null termination, we would probably have to make SvPV allocate a new string with the null, and introduce a new version of SvPV (SvPV_nn_ok(sv,len)?) that may return unterminated strings and assumes the caller will depend solely on the len value.

Of course, any code that passes SvPVX to a C function will probably break.  I don’t know whether there is any way to avoid that.  A survey of SvPVX uses on CPAN would be time-consuming, but helpful.


Father Chrysostomos

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