in reply to Re: Trying dirty trick with Imager and Inline C, but having difficulties. Can you help?
in thread Trying dirty trick with Imager and Inline C, but having difficulties. Can you help?
I was hoping to avoid copying i.e. re-use allocated string data. Thanks to your tip, I think a working solution can be:
void _replace( Imager img, SV* str ) { sv_force_normal( str ); unsigned char* ptr = SvPV_nolen( str ); myfree( img-> idata ); img-> idata = ptr; SvPV_set( str, savepv( "" ) ); }
It works, though I'm still not sure, is it really OK? Or too ugly? Or scandalously incorrect and will bite me some time later?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Trying dirty trick with Imager and Inline C, but having difficulties. Can you help?
by Anonymous Monk on Aug 02, 2015 at 07:50 UTC | |
by vr (Curate) on Aug 02, 2015 at 21:24 UTC |