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

Re: substr as parameter to a XS sub

Thread Previous | Thread Next
From:
=?UTF-8?Q?Alberto_Sim=c3=b5es?=
Date:
July 4, 2016 08:33
Subject:
Re: substr as parameter to a XS sub
Message ID:
e1cac44e-8fca-fa9c-efa6-ea022440e1dd@alfarrabio.di.uminho.pt

>>
>> Is this a bug, or something I am doing incorrectly?
>> I imagine this happens becuse substr can be used as an lvalue, but I am not
>> 100% sure.
>
> The SvPV_nolen() in the standard typemap for T_PV should handle that
> correctly.
>
> A non-default typemap that changes the mapping for char * or changes
> T_PV could break it.
>
> If you have a more complete example please open a ticket.

Hi.

You just found the problem, I think. This is the typemap:

T_PV
	$var = (SvOK ($arg)) ? ($type) SvPV ($arg,PL_na) : NULL

and this is the comment from the original author:

# this is needed so we can pass 'undef' for the filename to
# Text::BibTeX::Entry::parse and have it wind up as NULL
# in bt_parse_entry()

Can you help me working a new typemap?

Thanks
Alberto

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About