NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
reduce, reuse, recycle (Score:3, Informative)
Rather than copying the malloc()ed string into an SV and then free()ing it, check out
sv_usepvnwhich can directly take over the buffer. Sorry, I don't know the XS-fu to create a typemap to make your wrapper use this automatically.Maybe that useful function should be re-named
sv_borgto make it stand out more.Reply to This
Re:reduce, reuse, recycle (Score:1)
Nice! I was looking for something like that. In fact, I always blindly assumed that the 'char *' typemap would only copy the pointer and not the whole vector (till I realized that it does exactly that yesterday).
I think this can be turned into a typemap easily. AFAIK, there is no default typemap for 'const char*' so I can use that.
Maybe that useful function should be re-named sv_borg to make it stand out more.
Poison()macro did immediately spring into my