Updates to the c API to handle returning strings more safely

For functions that have a fixed return value, we can have c functions return pointers to static memory.
For functions that have differing return values, this is not safe (pointers returned will be invalidated by subsequent or concurrent calls to the functions).
This branch updates several functions to take string buffers as input in cases where we previously returned pointers to static memory.