From: Michael Tremer Date: Fri, 4 Oct 2024 13:32:29 +0000 (+0000) Subject: buildservice: Use new URL formatting feature X-Git-Tag: 0.9.30~1179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04f3f880f4fecb2b1bce63e191d824abacd2f2ec;p=pakfire.git buildservice: Use new URL formatting feature Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/buildservice.c b/src/libpakfire/buildservice.c index 64dfc07b1..0758c2624 100644 --- a/src/libpakfire/buildservice.c +++ b/src/libpakfire/buildservice.c @@ -355,16 +355,10 @@ ERROR: static int pakfire_buildservice_upload_payload(struct pakfire_buildservice* service, const char* filename, const char* uuid, FILE* f) { struct pakfire_xfer* xfer = NULL; - char url[PATH_MAX]; int r; - // Make the URL - r = pakfire_string_format(url, "/api/v1/uploads/%s", uuid); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/uploads/%s", uuid); if (r) goto ERROR; @@ -488,16 +482,10 @@ PAKFIRE_EXPORT int pakfire_buildservice_delete_upload( struct pakfire_buildservice* service, const char* uuid) { struct pakfire_xfer* xfer = NULL; struct json_object* response = NULL; - char url[PATH_MAX]; int r; - // Compose the URL - r = pakfire_string_format(url, "/api/v1/uploads/%s", uuid); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/uploads/%s", uuid); if (r) goto ERROR; @@ -532,20 +520,14 @@ PAKFIRE_EXPORT int pakfire_buildservice_list_repos(struct pakfire_buildservice* struct pakfire_xfer* xfer = NULL; struct json_object* response = NULL; struct json_object* repos = NULL; - char url[PATH_MAX]; int r; // Check inputs if (!distro) return -EINVAL; - // Compose path - r = pakfire_string_format(url, "/api/v1/repos/%s", distro); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/repos/%s", distro); if (r) goto ERROR; @@ -582,20 +564,14 @@ PAKFIRE_EXPORT int pakfire_buildservice_get_repo(struct pakfire_buildservice* se const char* distro, const char* name, struct json_object** p) { struct pakfire_xfer* xfer = NULL; struct json_object* response = NULL; - char url[PATH_MAX]; int r; // Check inputs if (!distro || !name) return -EINVAL; - // Compose URL - r = pakfire_string_format(url, "/api/v1/repos/%s/%s", distro, name); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/repos/%s/%s", distro, name); if (r) goto ERROR; @@ -625,20 +601,14 @@ PAKFIRE_EXPORT int pakfire_buildservice_create_repo(struct pakfire_buildservice* const char* distro, const char* name, const char* description, struct json_object** p) { struct pakfire_xfer* xfer = NULL; struct json_object* response = NULL; - char url[PATH_MAX]; int r; // Check inputs if (!distro) return -EINVAL; - // Compose path - r = pakfire_string_format(url, "/api/v1/repos/%s", distro); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/repos/%s", distro); if (r) goto ERROR; @@ -680,16 +650,10 @@ ERROR: PAKFIRE_EXPORT int pakfire_buildservice_delete_repo(struct pakfire_buildservice* service, const char* distro, const char* name) { struct pakfire_xfer* xfer = NULL; - char url[PATH_MAX]; int r; - // Compose the URL - r = pakfire_string_format(url, "/api/v1/repos/%s/%s", distro, name); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/repos/%s/%s", distro, name); if (r) goto ERROR; @@ -718,7 +682,6 @@ ERROR: PAKFIRE_EXPORT int pakfire_buildservice_job_finished(struct pakfire_buildservice* service, const char* uuid, int success, const char* logfile, const char** packages) { struct pakfire_xfer* xfer = NULL; - char url[PATH_MAX]; int r; unsigned int num_packages = 0; @@ -727,13 +690,8 @@ PAKFIRE_EXPORT int pakfire_buildservice_job_finished(struct pakfire_buildservice for (const char** package = packages; *package; packages++) num_packages++; - // Compose the URL - r = pakfire_string_format(url, "/api/v1/jobs/%s", uuid); - if (r) - goto ERROR; - // Create a new xfer - r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, url); + r = pakfire_httpclient_create_xfer(&xfer, service->httpclient, "/api/v1/jobs/%s", uuid); if (r) goto ERROR;