refactor(api): do not allocate temporaries for internal events

This commit is contained in:
bfredl
2023-01-03 15:24:41 +01:00
parent 5b22b32e50
commit b2295ac4ec
8 changed files with 47 additions and 48 deletions

View File

@@ -136,6 +136,7 @@ Object rpc_send_call(uint64_t id, const char *method_name, Array args, ArenaMem
uint32_t request_id = rpc->next_request_id++;
// Send the msgpack-rpc request
send_request(channel, request_id, method_name, args);
api_free_array(args);
// Push the frame
ChannelCallFrame frame = { request_id, false, false, NIL, NULL };
@@ -491,7 +492,6 @@ static void broadcast_event(const char *name, Array args)
});
if (!kv_size(subscribed)) {
api_free_array(args);
goto end;
}
@@ -593,7 +593,6 @@ static WBuffer *serialize_request(uint64_t channel_id, uint32_t request_id, cons
refcount,
xfree);
msgpack_sbuffer_clear(sbuffer);
api_free_array(args);
return rv;
}