From: Michael Tremer Date: Fri, 27 Jun 2025 08:55:59 +0000 (+0000) Subject: xfer: Remove unused code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=215093fc397df4af79ba82d5cb4138f9968a23cc;p=pakfire.git xfer: Remove unused code Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/xfer.c b/src/pakfire/xfer.c index 1b4136e2..f024ad98 100644 --- a/src/pakfire/xfer.c +++ b/src/pakfire/xfer.c @@ -1863,60 +1863,3 @@ static int pakfire_xfer_handle_api_error( return -c; } - -/* - This function parses an API response -*/ -static int pakfire_xfer_parse_api_response(struct pakfire_xfer* xfer, - const char* buffer, const size_t length, struct json_object** object) { - struct json_object* error = NULL; - struct json_object* o = NULL; - char* e = NULL; - int r; - - // Check if we received any data - if (!length) { - DEBUG(xfer->ctx, "Received an empty response\n"); - - // Reset the object - if (object) - *object = NULL; - - return 0; - } - - // XXX Maybe fetch the parser's error message here?! - - // Parse the buffer - r = pakfire_json_parse(&o, &e, buffer, length); - if (r < 0) { - ERROR(xfer->ctx, "Could not parse the response: %s\n", e); - goto ERROR; - } - - // Check if the response is a dictionary - if (!json_object_is_type(o, json_type_object)) { - ERROR(xfer->ctx, "The received object is not a JSON dict\n"); - r = -EBADMSG; - goto ERROR; - } - - // Fetch error - r = json_object_object_get_ex(o, "error", &error); - if (r) { - r = pakfire_xfer_handle_api_error(xfer, error); - goto ERROR; - } - - // Return the object - if (object) - *object = json_object_get(o); - -ERROR: - if (o) - json_object_put(o); - if (e) - free(e); - - return r; -}