From cf65ac5f7d058710435fb8c6113c1a120b76cbec Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 18 Jul 2023 01:08:30 +0200 Subject: json_rpc: removed unused routines --- src/json_rpc.c | 50 -------------------------------------------------- src/json_rpc.h | 6 ------ 2 files changed, 56 deletions(-) (limited to 'src') diff --git a/src/json_rpc.c b/src/json_rpc.c index 538cff0..7630f64 100644 --- a/src/json_rpc.c +++ b/src/json_rpc.c @@ -257,11 +257,6 @@ int jsonrpc_request_is_notification(const struct jsonrpc_request *request) return !json_has(request->impl, jsonrpc_key_id); } -const char *jsonrpc_request_to_string(struct jsonrpc_request *request) -{ - return json_to_string(request->impl); -} - static int jsonrpc_request_from_json(struct jsonrpc_request **_request, struct json_object *impl) { int ret = 0; @@ -290,26 +285,6 @@ static int jsonrpc_request_from_json(struct jsonrpc_request **_request, struct j return ret; } -int jsonrpc_request_parse(struct jsonrpc_request **_request, const char *src) -{ - struct json_object *impl = json_from_string(src); - if (!impl) { - log_err("JSON-RPC: failed to parse request\n"); - return -1; - } - - int ret = jsonrpc_request_from_json(_request, impl); - if (ret < 0) - goto free_impl; - - return ret; - -free_impl: - json_object_put(impl); - - return ret; -} - int jsonrpc_request_send(const struct jsonrpc_request *request, int fd) { return json_send(request->impl, fd); @@ -511,11 +486,6 @@ int jsonrpc_response_is_error(const struct jsonrpc_response *response) return json_has(response->impl, jsonrpc_key_error); } -const char *jsonrpc_response_to_string(struct jsonrpc_response *response) -{ - return json_to_string(response->impl); -} - static int jsonrpc_response_from_json(struct jsonrpc_response **_response, struct json_object *impl) { int ret = 0; @@ -541,26 +511,6 @@ static int jsonrpc_response_from_json(struct jsonrpc_response **_response, struc return ret; } -int jsonrpc_response_parse(struct jsonrpc_response **_response, const char *src) -{ - struct json_object *impl = json_from_string(src); - if (!impl) { - log_err("JSON-RPC: failed to parse response\n"); - return -1; - } - - int ret = jsonrpc_response_from_json(_response, impl); - if (ret < 0) - goto free_impl; - - return ret; - -free_impl: - json_object_put(impl); - - return ret; -} - int jsonrpc_response_send(const struct jsonrpc_response *response, int fd) { return json_send(response->impl, fd); diff --git a/src/json_rpc.h b/src/json_rpc.h index 6e2be04..f3c67a9 100644 --- a/src/json_rpc.h +++ b/src/json_rpc.h @@ -24,9 +24,6 @@ int jsonrpc_notification_create(struct jsonrpc_request **, const char *method, struct json_object *params); int jsonrpc_request_is_notification(const struct jsonrpc_request *); -const char *jsonrpc_request_to_string(struct jsonrpc_request *); -int jsonrpc_request_parse(struct jsonrpc_request **, const char *src); - int jsonrpc_request_send(const struct jsonrpc_request *, int fd); int jsonrpc_request_recv(struct jsonrpc_request **, int fd); @@ -48,9 +45,6 @@ int jsonrpc_error_create(struct jsonrpc_response **, struct jsonrpc_request *, i const char *message); int jsonrpc_response_is_error(const struct jsonrpc_response *); -const char *jsonrpc_response_to_string(struct jsonrpc_response *); -int jsonrpc_response_parse(struct jsonrpc_response **, const char *src); - int jsonrpc_response_send(const struct jsonrpc_response *, int fd); int jsonrpc_response_recv(struct jsonrpc_response **, int fd); -- cgit v1.2.3