Prefer binary realloc to self-managed buffers

Use erlang's allocator and simplify the code by writing into the
buffer we're going to give back anyway.

Also introduce a function to NUL-terminate iolist buffers, which can
avoid memory copying.
This commit is contained in:
Carlos Martín Nieto
2013-05-02 13:09:51 +02:00
parent ef7d2d5490
commit 616a358dc7
6 changed files with 33 additions and 89 deletions

View File

@@ -29,4 +29,7 @@ typedef struct {
extern geef_atoms atoms;
/** NUL-terminate a binary */
int geef_terminate_binary(ErlNifBinary *bin);
#endif