W
Wolfram Humann
This XS code can be found in many CPAN modules (e.g. Zlib.xs):
if (!SvUPGRADE(buf, SVt_PV))
croak("cannot use buf argument as lvalue");
It is used before sending "SV * buf" to a C function that will fill buf
with some string. I wanted to use the same in my code but just could not
get it to "carp" even if I passed numeric or string constants to buf.
When I say
if (SvREADONLY(buf))
croak("cannot use buf argument as lvalue");
instead (and "SvUPGRADE" separately), the test works as expected. I
looked at sv_upgrade in sv.c and found two "return TRUE;" statements but
no way for the function to return FALSE.
Did sv_upgrade change at some point, so that the test used above does
not work anymore? Any insights?
Wolfram
if (!SvUPGRADE(buf, SVt_PV))
croak("cannot use buf argument as lvalue");
It is used before sending "SV * buf" to a C function that will fill buf
with some string. I wanted to use the same in my code but just could not
get it to "carp" even if I passed numeric or string constants to buf.
When I say
if (SvREADONLY(buf))
croak("cannot use buf argument as lvalue");
instead (and "SvUPGRADE" separately), the test works as expected. I
looked at sv_upgrade in sv.c and found two "return TRUE;" statements but
no way for the function to return FALSE.
Did sv_upgrade change at some point, so that the test used above does
not work anymore? Any insights?
Wolfram