powerman has asked for the wisdom of the Perl Monks concerning the following question:
c_func(undef); # NULL param c_func(''); # empty string param c_func(123); # string '123' param c_func('qwe'); # string 'qwe' param
Current XS realization:
void c_func(param) char * param = SvOK(ST(0)) ? SvPV_nolen(ST(0)) : NULL;
This task sounds like standard opration, so is there exists simpler way, without ugly "SvOK ? SvPV_nolen : NULL" chain?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XS: SvOK ? SvPV_nolen : NULL
by creamygoodness (Curate) on Jun 08, 2006 at 15:12 UTC | |
|
Re: XS: SvOK ? SvPV_nolen : NULL
by wazzuteke (Hermit) on Jun 08, 2006 at 19:38 UTC |