Avoid using PL_na with newSVpv

2013-09-25 Thread Torsten Schoenfeld
I recently tracked down a difficult bug that occured only when one of my XS modules was used in conjunction with certain other XS modules (e.g., XML::Parser or String::Approx). It turned out to be due to the incorrect assumption that PL_na will always be zero. Specifically, we used newSVpv

Re: Avoid using PL_na with newSVpv

2013-09-25 Thread Jan Dubois
On Wed, Sep 25, 2013 at 11:50 AM, Torsten Schoenfeld kaffeeti...@gmx.de wrote: newSVpv (string, PL_na) // do not do this Is this recomended anywhere? PL_na is a legacy variable that used to be used for str = SvPV(sv, PL_na); in case you don't care about the length of the string. Since

Re: Avoid using PL_na with newSVpv

2013-09-25 Thread Torsten Schoenfeld
On 25.09.2013 20:56, Jan Dubois wrote: On Wed, Sep 25, 2013 at 11:50 AM, Torsten Schoenfeld kaffeeti...@gmx.de wrote: newSVpv (string, PL_na) // do not do this Is this recomended anywhere? Probably not. But http://grep.cpan.me/?q=newSVpv.*PL_na does show quite a few hits, only roughly

Re: Avoid using PL_na with newSVpv

2013-09-25 Thread Jan Dubois
On Wed, Sep 25, 2013 at 12:04 PM, Torsten Schoenfeld kaffeeti...@gmx.de wrote: Probably not. But http://grep.cpan.me/?q=newSVpv.*PL_na does show quite a few hits, only roughly half of which are mine. Since the bugs this causes are hard to diagnose, I thought a public service announcement is