This follows two other functions logic: uh_ubus_send_request() and
uh_ubus_allowed(). Thanks to this change global "buf" variable is used
only for replies and doesn't require state tracking & reinitialization.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
struct dispatch_ubus *du = &cl->dispatch.ubus;
struct json_object *obj = du->jsobj_cur, *obj2 = NULL;
struct dispatch_ubus *du = &cl->dispatch.ubus;
struct json_object *obj = du->jsobj_cur, *obj2 = NULL;
- blob_buf_init(&buf, 0);
blobmsg_add_string(&buf, "jsonrpc", "2.0");
if (obj)
blobmsg_add_string(&buf, "jsonrpc", "2.0");
if (obj)
struct dispatch_ubus *du = &cl->dispatch.ubus;
struct rpc_data data = {};
enum rpc_error err = ERROR_PARSE;
struct dispatch_ubus *du = &cl->dispatch.ubus;
struct rpc_data data = {};
enum rpc_error err = ERROR_PARSE;
+ static struct blob_buf req;
goto error;
du->jsobj_cur = obj;
goto error;
du->jsobj_cur = obj;
- blob_buf_init(&buf, 0);
- if (!blobmsg_add_object(&buf, obj))
+ blob_buf_init(&req, 0);
+ if (!blobmsg_add_object(&req, obj))
- if (!parse_json_rpc(&data, buf.head))
+ if (!parse_json_rpc(&data, req.head))
goto error;
if (!strcmp(data.method, "call")) {
goto error;
if (!strcmp(data.method, "call")) {