|
The realpath function is called using FFI. One approach
passes a null pointer, so that the function dynamically
allocates. The return value is str-d, causing FFI to take
ownership of the pointer, freeing it. The other approach
is to pass a pointer to a large null-terminated character
array, marked for ownership transfer to the function. FFI
allocates it and puts the argument into it, which is just
a dummy empty string. The function fills that buffer and
returns it. The return is captured as a str-d, so FFI takes
ownership back, and frees the buffer.
* tests/017/realpath.tl: New function.
* tests/017/realpath.expected: Likewise.
|