in reply to Re: Perl XS: garbage-collecting my malloc'd buffer
in thread Perl XS: garbage-collecting my malloc'd buffer
You don't need to '\0'-terminate the buffer. Perl doesn't care about the '\0' when reading a string value since you specified a length and Perl will append a '\0' onto the end "just in case" after it copies it.
You could probably simplify the code slightly by using CODE: instead of PPCODE: (you are only ever returning one value) so that you just deal with RETVAL instead of manipulating the stack.
So it looks fine.- tye