You can see this implementation on our repo.
I'm not going to review your code.
newSV_type is a new addition to the core. If you want to support older Perls, you'll have to use something else, or include ppport (which isn't hard, and will handle other such problems if any). I chose newSV_type because it doesn't create a string buffer that will end up being freed.
What are the fragile issues that you can see?
I was referring to how easy it is to accidentally replace the PV. If it's a private interface between your XS and Perl components, no problem. If it's a public interface, it's a problem.
What more can I do ensure memory handling is done correctly
Test your code using valgrind.
In reply to Re^3: Writing to Pointer Values (PV) in XS
by ikegami
in thread Writing to Pointer Values (PV) in XS
by kthakore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |