API: Refactor: Duplicate/free string arguments coming from msgpack

When receiving strings *from* msgpack, we don't need to duplicate/free since
the data only lives in the msgpack parse buffer until the end of the call.

But in order to reuse `msgpack_rpc_free_object` when sending event data(which is
sent *to* msgpack), Strings must be freed, which means they must also be
allocated separately.
This commit is contained in:
Thiago de Arruda
2014-05-26 13:39:05 -03:00
parent 339d106f7c
commit 4bac5e9ce1
5 changed files with 20 additions and 8 deletions

View File

@@ -307,7 +307,7 @@ Integer buffer_get_number(Buffer buffer, Error *err)
String buffer_get_name(Buffer buffer, Error *err)
{
String rv = {.size = 0, .data = ""};
String rv = STRING_INIT;
buf_T *buf = find_buffer(buffer, err);
if (!buf || buf->b_ffname == NULL) {