]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Create its own type
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 15:13:16 +0000 (15:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 15:13:16 +0000 (15:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
20 files changed:
src/cli/lib/api.c
src/cli/lib/api.h
src/cli/lib/client-build.c
src/cli/lib/repo_delete.c
src/cli/lib/upload_list.c
src/pakfire/builder.c
src/pakfire/builder.h
src/pakfire/client.c
src/pakfire/client.h
src/pakfire/dist.c
src/pakfire/httpclient.c
src/pakfire/httpclient.h
src/pakfire/job.c
src/pakfire/repo.c
src/pakfire/repo.h
src/pakfire/transaction.c
src/pakfire/xfer.c
src/pakfire/xfer.h
tests/libpakfire/httpclient.c
tests/libpakfire/xfer.c

index d92cad75a48bf99049b14cf0b42ade7092632f32..cb929b5b96037bbf3caab1c6a01474a977d4b19f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "api.h"
 
-int cli_api_error(const struct pakfire_xfer_response* response,
+int cli_api_error(const pakfire_xfer_response* response,
                const char* format, ...) {
        char* prefix = NULL;
        char* error = NULL;
index 748157caefbbba912c08da1cf6895f32d9dfbafd..9d345f322ba864ed93cfc1c42dcfa527af655c71 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <pakfire/xfer.h>
 
-int cli_api_error(const struct pakfire_xfer_response* response, const char* format, ...)
+int cli_api_error(const pakfire_xfer_response* response, const char* format, ...)
        __attribute__((format(printf, 2, 3)));;
 
 #endif /* PAKFIRE_CLI_API_H */
index 2a1495e5a2959e4e77ac325891cceb876755b508..a6e79ff1edeaa1e9c7e0dcc2ead91df34f421f67 100644 (file)
@@ -99,7 +99,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int build_callback(struct pakfire_xfer* xfer,
+static int build_callback(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        const char* uuid = NULL;
        int r;
index 903c685328773468b7433efe348567ee588af71c..43da5fe19c272dd59c4e40eef2ce2163e94e4cfc 100644 (file)
@@ -60,7 +60,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int response_callback(struct pakfire_xfer* xfer,
+static int response_callback(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        if (!response->error)
                return cli_dump_json(response->data);
index cc40788d3624167e5d75868e18c90d5e090fd25c..b2f6d54f6925bae975214083b4fb6117a6a28923 100644 (file)
@@ -29,7 +29,7 @@
 
 static const char* doc = "Lists all uploads";
 
-static int list_callback(struct pakfire_xfer* xfer,
+static int list_callback(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        // XXX For now, just dump the entire JSON object
        return cli_dump_json(response->data);
index 42b82fad80a52aa9fd568eba37209405021ce2df..3d7d0ea86d4107c6e79e094ef528c4d63c542566 100644 (file)
@@ -51,7 +51,7 @@ struct pakfire_builder {
        pakfire_client* client;
 
        // Control Connection
-       struct pakfire_xfer* control;
+       pakfire_xfer* control;
 
        // Stats Timer
        sd_event_source* stats_timer;
@@ -384,7 +384,7 @@ ERROR:
        return r;
 }
 
-int pakfire_builder_connected(struct pakfire_xfer* xfer, void* data) {
+int pakfire_builder_connected(pakfire_xfer* xfer, void* data) {
        pakfire_builder* self = data;
        int r;
 
@@ -405,7 +405,7 @@ int pakfire_builder_connected(struct pakfire_xfer* xfer, void* data) {
        This function is called whenever the connection to the build service could not
        be established or was interrupted. It will try to reconnect.
 */
-int pakfire_builder_close(struct pakfire_xfer* xfer, int code, void* data) {
+int pakfire_builder_close(pakfire_xfer* xfer, int code, void* data) {
        pakfire_builder* self = data;
        int r;
 
@@ -645,7 +645,7 @@ static int pakfire_builder_handle_message(pakfire_builder* self, struct json_obj
        return 0;
 }
 
-int pakfire_builder_recv(struct pakfire_xfer* xfer,
+int pakfire_builder_recv(pakfire_xfer* xfer,
                const char* message, const size_t size, void* data) {
        pakfire_builder* self = data;
        struct json_object* m = NULL;
@@ -671,7 +671,7 @@ ERROR:
        return r;
 }
 
-int pakfire_builder_send(struct pakfire_xfer* xfer, void* data) {
+int pakfire_builder_send(pakfire_xfer* xfer, void* data) {
        pakfire_builder* self = data;
 
        // Stream logs
index a6cc606e4a9cb7e0d952ef6ad57ffe771b0275e3..672ee79787a2cbbab408fe68eb68a8f0ab604a26 100644 (file)
@@ -41,10 +41,10 @@ pakfire_builder* pakfire_builder_unref(pakfire_builder* self);
 int pakfire_builder_connect(pakfire_builder* self);
 
 // Socket Callbacks
-int pakfire_builder_connected(struct pakfire_xfer* xfer, void* data);
-int pakfire_builder_close(struct pakfire_xfer* xfer, int code, void* data);
-int pakfire_builder_recv(struct pakfire_xfer* xfer, const char* message, const size_t size, void* data);
-int pakfire_builder_send(struct pakfire_xfer* xfer, void* data);
+int pakfire_builder_connected(pakfire_xfer* xfer, void* data);
+int pakfire_builder_close(pakfire_xfer* xfer, int code, void* data);
+int pakfire_builder_recv(pakfire_xfer* xfer, const char* message, const size_t size, void* data);
+int pakfire_builder_send(pakfire_xfer* xfer, void* data);
 
 int pakfire_builder_send_message(pakfire_builder* self, struct json_object* message);
 
index 4ad67e4d9c3d7b1eff1273756985cc2c236fde78..81761d511b81dde83f610fe6e5143f7c422266ee 100644 (file)
@@ -113,12 +113,12 @@ struct pakfire_client {
        STAILQ_HEAD(uploads, pakfire_client_upload) uploads;
 };
 
-static int pakfire_client_xfer_create(struct pakfire_xfer** xfer,
+static int pakfire_client_xfer_create(pakfire_xfer** xfer,
        pakfire_client* self, const char* url, ...) __attribute__((format(printf, 3, 4)));
 
-static int pakfire_client_xfer_create(struct pakfire_xfer** xfer,
+static int pakfire_client_xfer_create(pakfire_xfer** xfer,
                pakfire_client* self, const char* url, ...) {
-       struct pakfire_xfer* x = NULL;
+       pakfire_xfer* x = NULL;
        va_list args;
        int r;
 
@@ -166,7 +166,7 @@ static int pakfire_client_ready(pakfire_client* self) {
        return 0;
 }
 
-static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
+static int pakfire_client_auth_response(pakfire_xfer* xfer,
        const pakfire_xfer_response* response, void* data);
 
 static int pakfire_client_auth_required(pakfire_client* self);
@@ -175,7 +175,7 @@ static int pakfire_client_auth_required(pakfire_client* self);
        Triggers a refresh of the access and refresh tokens
 */
 static int pakfire_client_auth_refresh(pakfire_client* self) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
        int r;
 
@@ -427,7 +427,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_client_xfer_auth(pakfire_client* self, struct pakfire_xfer* xfer) {
+static int pakfire_client_xfer_auth(pakfire_client* self, pakfire_xfer* xfer) {
        int r;
 
        // Fail if not authenticated
@@ -611,7 +611,7 @@ int pakfire_client_set_auth_callback(pakfire_client* self,
        return 0;
 }
 
-static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
+static int pakfire_client_auth_response(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        pakfire_client* self = data;
        const char* refresh_token = NULL;
@@ -656,7 +656,7 @@ static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
 }
 
 int pakfire_client_auth_user(pakfire_client* self, const char* password) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        struct {
                char* username;
                char* password;
@@ -713,7 +713,7 @@ ERROR:
 #if 0
 int pakfire_client_auth_builder(pakfire_client* self,
                const char* username, const char* password) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char hostname[HOST_NAME_MAX];
        struct {
                char* username;
@@ -803,7 +803,7 @@ ERROR:
 }
 
 int pakfire_client_builder_connect(pakfire_client* self, pakfire_builder* builder) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new xfer
@@ -838,7 +838,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_builder_disconnected(pakfire_client* self, struct pakfire_xfer* xfer) {
+int pakfire_client_builder_disconnected(pakfire_client* self, pakfire_xfer* xfer) {
        int r;
 
        // Remove the connection from the client
@@ -853,7 +853,7 @@ int pakfire_client_builder_disconnected(pakfire_client* self, struct pakfire_xfe
 
 int pakfire_client_build(pakfire_client* self, const char* upload, const char* repo,
                const char** arches, int flags, pakfire_xfer_response_callback callback, void* data) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
        int r;
 
@@ -1016,7 +1016,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_upload_payload_callback(struct pakfire_xfer* xfer,
+static int pakfire_upload_payload_callback(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        pakfire_client_upload_status s = PAKFIRE_CLIENT_UPLOAD_SUCCESSFUL;
        pakfire_client_upload* upload = data;
@@ -1044,7 +1044,7 @@ static int pakfire_upload_payload_callback(struct pakfire_xfer* xfer,
 
 static int pakfire_client_upload_payload(pakfire_client_upload* upload) {
        pakfire_client* self = upload->client;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new xfer
@@ -1084,7 +1084,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_client_upload_response(struct pakfire_xfer* xfer,
+static int pakfire_client_upload_response(pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        pakfire_client_upload* self = data;
        const char* uuid = NULL;
@@ -1113,7 +1113,7 @@ int pakfire_client_upload_create(pakfire_client* self,
        pakfire_client_upload* upload = NULL;
        struct json_object* request = NULL;
        char* hexdigest_blake2b512 = NULL;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new upload
@@ -1186,7 +1186,7 @@ ERROR:
 
 int pakfire_client_list_uploads(pakfire_client* self,
                pakfire_client_list_uploads_callback callback, void* data) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new xfer
@@ -1217,7 +1217,7 @@ ERROR:
 }
 
 int pakfire_client_delete_upload(pakfire_client* self, const char* uuid) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new xfer
@@ -1250,7 +1250,7 @@ ERROR:
 // Repositories
 
 int pakfire_client_list_repos(pakfire_client* self, const char* distro) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Check inputs
@@ -1283,7 +1283,7 @@ ERROR:
 
 int pakfire_client_get_repo(pakfire_client* self,
                const char* distro, const char* name) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Check inputs
@@ -1316,7 +1316,7 @@ ERROR:
 
 int pakfire_client_create_repo(pakfire_client* self,
                const char* distro, const char* name, const char* description) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
        int r;
 
@@ -1374,7 +1374,7 @@ ERROR:
 
 int pakfire_client_delete_repo(pakfire_client* self, const char* distro,
                const char* name, pakfire_xfer_response_callback callback, void* data) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new xfer
@@ -1415,7 +1415,7 @@ ERROR:
 int pakfire_client_job_finished(pakfire_client* self,
                const char* job_id, const char* logfile, char** packages) {
        struct json_object* request = NULL;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new request object
index 00cbea1fffcf2858a5cd87e3fd807a07c188e5e9..17ab0f953ecc41958823aac37a56c413982d0841 100644 (file)
@@ -68,7 +68,7 @@ int pakfire_client_builder(pakfire_builder** builder, pakfire_client* self);
 
 // Low-level functions
 int pakfire_client_builder_connect(pakfire_client* self, pakfire_builder* builder);
-int pakfire_client_builder_disconnected(pakfire_client* self, struct pakfire_xfer* xfer);
+int pakfire_client_builder_disconnected(pakfire_client* self, pakfire_xfer* xfer);
 
 // Builds
 
index 59c274a7b82ee4a6984ed75b17cb5ee6a1f9c084..6ab714106508802072db0933b10474e3b7323604 100644 (file)
@@ -286,7 +286,7 @@ static int pakfire_dist_download_source(pakfire_ctx* ctx,
 
 static int pakfire_dist_download_source(pakfire_ctx* ctx,
                pakfire_mirrorlist* mirrorlist, const char* cache_path, const char* filename, ...) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        va_list args;
        int r;
 
index 5617a6587efdeac8dea27ac78926573ffc3d744e..94181ca68dfbb6bbbe8cf564b83ab540627888d8 100644 (file)
@@ -39,7 +39,7 @@
 typedef struct pakfire_httpclient_xfer {
        TAILQ_ENTRY(pakfire_httpclient_xfer) nodes;
 
-       struct pakfire_xfer* xfer;
+       pakfire_xfer* xfer;
 
        // Store the status
        enum pakfire_httpclient_xfer_status {
@@ -98,7 +98,7 @@ static int pakfire_httpclient_has_flag(pakfire_httpclient* self, int flags) {
 }
 
 static int pakfire_httpclient_xfer_create(
-               pakfire_httpclient_xfer** x, struct pakfire_xfer* xfer) {
+               pakfire_httpclient_xfer** x, pakfire_xfer* xfer) {
        pakfire_httpclient_xfer* e = NULL;
 
        // Allocate some space
@@ -160,7 +160,7 @@ static pakfire_httpclient_xfer* pakfire_httpclient_get_queued_xfer(pakfire_httpc
 }
 
 static pakfire_httpclient_xfer* pakfire_httpclient_xfer_find(
-               pakfire_httpclient* self, struct pakfire_xfer* xfer) {
+               pakfire_httpclient* self, pakfire_xfer* xfer) {
        pakfire_httpclient_xfer* e = NULL;
 
        TAILQ_FOREACH(e, &self->xfers, nodes) {
@@ -257,7 +257,7 @@ static int pakfire_httpclient_launch(pakfire_httpclient* self) {
 
 static int pakfire_httpclient_check(pakfire_httpclient* self) {
        pakfire_httpclient_xfer* e = NULL;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        CURLMsg* msg = NULL;
@@ -756,7 +756,7 @@ pakfire_httpclient* pakfire_httpclient_unref(pakfire_httpclient* self) {
        return NULL;
 }
 
-int pakfire_httpclient_enqueue(pakfire_httpclient* self, struct pakfire_xfer* xfer) {
+int pakfire_httpclient_enqueue(pakfire_httpclient* self, pakfire_xfer* xfer) {
        pakfire_httpclient_xfer* e = NULL;
        int r;
 
@@ -778,7 +778,7 @@ int pakfire_httpclient_enqueue(pakfire_httpclient* self, struct pakfire_xfer* xf
        return 0;
 }
 
-int pakfire_httpclient_dequeue(pakfire_httpclient* self, struct pakfire_xfer* xfer) {
+int pakfire_httpclient_dequeue(pakfire_httpclient* self, pakfire_xfer* xfer) {
        pakfire_httpclient_xfer* e = NULL;
        int r;
 
index a0cf53c9b78e37877eb81b87ea23d0a1cf498827..1460e56530417a681f4ad7d21b811846ec14cf25 100644 (file)
@@ -32,8 +32,8 @@ int pakfire_httpclient_create(pakfire_httpclient** client,
 pakfire_httpclient* pakfire_httpclient_ref(pakfire_httpclient* self);
 pakfire_httpclient* pakfire_httpclient_unref(pakfire_httpclient* self);
 
-int pakfire_httpclient_enqueue(pakfire_httpclient* self, struct pakfire_xfer* xfer);
-int pakfire_httpclient_dequeue(pakfire_httpclient* self, struct pakfire_xfer* xfer);
+int pakfire_httpclient_enqueue(pakfire_httpclient* self, pakfire_xfer* xfer);
+int pakfire_httpclient_dequeue(pakfire_httpclient* self, pakfire_xfer* xfer);
 
 int pakfire_httpclient_run(pakfire_httpclient* self, const char* title);
 
index 9c5f9a4384f5a7b6337bc5f5c90ecd88fc0c7555..43fb96c6ae2d30ac35df2a16441da4b4643f932d 100644 (file)
@@ -458,7 +458,7 @@ ERROR:
 */
 static int pakfire_job_exited(sd_event_source* s, const siginfo_t* si, void* data) {
        pakfire_job* job = data;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        const char* filename = NULL;
        const char* path = NULL;
        int r;
index 7bccaaea40bf4f7950f849c7210843704ed95f63..64da9b29093dec88081189acabc6887675e4bfc6 100644 (file)
@@ -261,7 +261,7 @@ int __pakfire_repo_path(pakfire_repo* repo,
        return __pakfire_cache_path(repo->pakfire, path, length, "%s/%s", name, buffer);
 }
 
-static int pakfire_repo_xfer_create(struct pakfire_xfer** xfer, pakfire_repo* repo,
+static int pakfire_repo_xfer_create(pakfire_xfer** xfer, pakfire_repo* repo,
        const char* url, ...) __attribute__((format(printf, 3, 4)));
 
 /*
@@ -269,9 +269,9 @@ static int pakfire_repo_xfer_create(struct pakfire_xfer** xfer, pakfire_repo* re
        settings of this repository.
 */
 static int pakfire_repo_xfer_create(
-               struct pakfire_xfer** xfer, pakfire_repo* repo, const char* url, ...) {
+               pakfire_xfer** xfer, pakfire_repo* repo, const char* url, ...) {
        pakfire_mirrorlist* mirrorlist = NULL;
-       struct pakfire_xfer* x = NULL;
+       pakfire_xfer* x = NULL;
        const char* baseurl = NULL;
        va_list args;
        int r;
@@ -821,7 +821,7 @@ static int pakfire_repo_sync(pakfire_repo* self) {
 
 static int pakfire_repo_download_database(
                pakfire_repo* repo, const char* filename, const char* path) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char title[NAME_MAX];
        int r;
 
@@ -1106,7 +1106,7 @@ ERROR:
 
 static int pakfire_repo_download_mirrorlist(pakfire_repo* self,
                const char* path, const int force) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char* url = NULL;
        time_t age = -1;
        int r;
@@ -1210,7 +1210,7 @@ ERROR:
 static int pakfire_repo_verify_metadata(
                pakfire_repo* self, const pakfire_buffer* repomd) {
        pakfire_buffer signature = {};
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        FILE* f = NULL;
        int r;
 
@@ -1262,7 +1262,7 @@ ERROR:
 static int pakfire_repo_download_metadata(pakfire_repo* repo, const char* path, int force) {
        pakfire_repomd repomd = {};
        pakfire_buffer buffer = {};
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        struct json_object* json = NULL;
        char* error = NULL;
        int r;
@@ -1851,13 +1851,13 @@ int pakfire_repo_is_installed_repo(pakfire_repo* self) {
        return (self->repo == self->repo->pool->installed);
 }
 
-int pakfire_repo_download_package(struct pakfire_xfer** xfer,
+int pakfire_repo_download_package(pakfire_xfer** xfer,
                pakfire_repo* repo, pakfire_package* pkg) {
        enum pakfire_hash_type hash = PAKFIRE_HASH_UNDEFINED;
        const unsigned char* checksum = NULL;
        size_t checksum_length = 0;
        struct pakfire_hashes hashes = {};
-       struct pakfire_xfer* x = NULL;
+       pakfire_xfer* x = NULL;
        const char* cache_path = NULL;
        const char* nevra = NULL;
        const char* url = NULL;
@@ -1944,7 +1944,7 @@ ERROR:
 
 static int pakfire_repo_download(pakfire_repo* repo, const char* url,
                pakfire_package** package) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        FILE* f = NULL;
        int r;
 
index bff2e8ecb03ac9248dceea9878a4677f309fe69d..5d1158feda235837835f8588fdebd56ce340f5be 100644 (file)
@@ -136,7 +136,7 @@ int __pakfire_repo_make_path(pakfire_repo* self,
 int pakfire_repo_import_archive(pakfire_repo* self,
        pakfire_archive* archive, pakfire_package** package);
 
-int pakfire_repo_download_package(struct pakfire_xfer** xfer,
+int pakfire_repo_download_package(pakfire_xfer** xfer,
        pakfire_repo* repo, pakfire_package* pkg);
 
 int pakfire_repo_add(pakfire_repo* repo, const char* path,
index 8b891d5f28fe7e62d3b7f099576aa43828395faa..015cef2a35f738b24d0805d9b0eefabe8ef2fc5a 100644 (file)
@@ -1925,7 +1925,7 @@ ERROR:
 static int pakfire_transaction_download_package(pakfire_transaction* transaction,
                pakfire_httpclient* httpclient, pakfire_package* pkg) {
        pakfire_repo* repo = NULL;
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r;
 
        // Fetch the repository to download from
index e6eca9f6b50f8cca89d2f955fb9ed15f36ce7452..c8a80d722cf6438c07f56158e4781d8558d190fd 100644 (file)
@@ -134,7 +134,7 @@ struct pakfire_xfer {
        } state;
 };
 
-static void pakfire_xfer_free(struct pakfire_xfer* xfer) {
+static void pakfire_xfer_free(pakfire_xfer* xfer) {
        // Unlink
        if (*xfer->tmpfile)
                unlink(xfer->tmpfile);
@@ -214,13 +214,13 @@ static int pakfire_xfer_debug_callback(CURL *handle, curl_infotype type,
 #endif
 
 static size_t pakfire_xfer_read(char* data, size_t size, size_t nmemb, void* p) {
-       struct pakfire_xfer* xfer = p;
+       pakfire_xfer* xfer = p;
 
        return fread(data, size, nmemb, xfer->fout);
 }
 
 static int pakfire_xfer_seek(void* p, curl_off_t offset, int origin) {
-       struct pakfire_xfer* xfer = p;
+       pakfire_xfer* xfer = p;
        int r;
 
        // Perform the seek
@@ -233,7 +233,7 @@ static int pakfire_xfer_seek(void* p, curl_off_t offset, int origin) {
 
 static size_t pakfire_xfer_write(
                char* data, size_t size, size_t nmemb, void* p) {
-       struct pakfire_xfer* xfer = p;
+       pakfire_xfer* xfer = p;
        int r;
 
        // Do not write empty blocks
@@ -255,7 +255,7 @@ static size_t pakfire_xfer_write(
        return fwrite(data, size, nmemb, xfer->fin);
 }
 
-static int pakfire_xfer_setup(struct pakfire_xfer* xfer) {
+static int pakfire_xfer_setup(pakfire_xfer* xfer) {
        pakfire_config* config = NULL;
        const char* proxy = NULL;
        int r;
@@ -347,12 +347,12 @@ ERROR:
        return r;
 }
 
-static int __pakfire_xfer_create_simple(struct pakfire_xfer** xfer,
+static int __pakfire_xfer_create_simple(pakfire_xfer** xfer,
        pakfire_ctx* ctx, const char* url, ...) __attribute__((format(printf, 3, 4)));
 
 // A helper function to create va_list
 static int __pakfire_xfer_create_simple(
-               struct pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url, ...) {
+               pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url, ...) {
        va_list args;
        int r;
 
@@ -367,13 +367,13 @@ static int __pakfire_xfer_create_simple(
 }
 
 int pakfire_xfer_create_simple(
-               struct pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url) {
+               pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url) {
        return __pakfire_xfer_create_simple(xfer, ctx, "%s", url);
 }
 
-int pakfire_xfer_create(struct pakfire_xfer** xfer,
+int pakfire_xfer_create(pakfire_xfer** xfer,
                pakfire_ctx* ctx, const char* url, va_list args) {
-       struct pakfire_xfer* x = NULL;
+       pakfire_xfer* x = NULL;
        int r;
 
        // Fail if the context is flagged as offline
@@ -420,13 +420,13 @@ ERROR:
        return r;
 }
 
-struct pakfire_xfer* pakfire_xfer_ref(struct pakfire_xfer* xfer) {
+pakfire_xfer* pakfire_xfer_ref(pakfire_xfer* xfer) {
        ++xfer->nrefs;
 
        return xfer;
 }
 
-struct pakfire_xfer* pakfire_xfer_unref(struct pakfire_xfer* xfer) {
+pakfire_xfer* pakfire_xfer_unref(pakfire_xfer* xfer) {
        if (--xfer->nrefs > 0)
                return xfer;
 
@@ -434,11 +434,11 @@ struct pakfire_xfer* pakfire_xfer_unref(struct pakfire_xfer* xfer) {
        return NULL;
 }
 
-CURL* pakfire_xfer_handle(struct pakfire_xfer* xfer) {
+CURL* pakfire_xfer_handle(pakfire_xfer* xfer) {
        return xfer->handle;
 }
 
-int pakfire_xfer_set_method(struct pakfire_xfer* xfer,
+int pakfire_xfer_set_method(pakfire_xfer* xfer,
                const pakfire_xfer_method_t method) {
        const char* m = NULL;
 
@@ -454,7 +454,7 @@ int pakfire_xfer_set_method(struct pakfire_xfer* xfer,
        return curl_easy_setopt(xfer->handle, CURLOPT_CUSTOMREQUEST, m);
 }
 
-const char* pakfire_xfer_get_title(struct pakfire_xfer* xfer) {
+const char* pakfire_xfer_get_title(pakfire_xfer* xfer) {
        char title[PATH_MAX];
        int r;
 
@@ -474,11 +474,11 @@ const char* pakfire_xfer_get_title(struct pakfire_xfer* xfer) {
        return xfer->title;
 }
 
-int pakfire_xfer_set_title(struct pakfire_xfer* xfer, const char* title) {
+int pakfire_xfer_set_title(pakfire_xfer* xfer, const char* title) {
        return pakfire_string_set(xfer->title, title);
 }
 
-int pakfire_xfer_set_baseurl(struct pakfire_xfer* xfer, const char* baseurl) {
+int pakfire_xfer_set_baseurl(pakfire_xfer* xfer, const char* baseurl) {
        int r;
 
        // Store the URL
@@ -496,14 +496,14 @@ int pakfire_xfer_set_baseurl(struct pakfire_xfer* xfer, const char* baseurl) {
        return 0;
 }
 
-const char* pakfire_xfer_get_effective_url(struct pakfire_xfer* xfer) {
+const char* pakfire_xfer_get_effective_url(pakfire_xfer* xfer) {
        return xfer->effective_url;
 }
 
 /*
        Helper function to set a chosen mirror
 */
-static int pakfire_xfer_select_mirror(struct pakfire_xfer* self, pakfire_mirror* mirror) {
+static int pakfire_xfer_select_mirror(pakfire_xfer* self, pakfire_mirror* mirror) {
        // Free the previous mirror
        if (self->mirror) {
                pakfire_mirror_unref(self->mirror);
@@ -524,7 +524,7 @@ static int pakfire_xfer_select_mirror(struct pakfire_xfer* self, pakfire_mirror*
        return 0;
 }
 
-int pakfire_xfer_set_mirrorlist(struct pakfire_xfer* xfer, pakfire_mirrorlist* mirrors) {
+int pakfire_xfer_set_mirrorlist(pakfire_xfer* xfer, pakfire_mirrorlist* mirrors) {
        pakfire_mirror* mirror = NULL;
        int r;
 
@@ -556,21 +556,21 @@ ERROR:
 
 // Size
 
-size_t pakfire_xfer_get_size(struct pakfire_xfer* xfer) {
+size_t pakfire_xfer_get_size(pakfire_xfer* xfer) {
        return xfer->expected_size;
 }
 
-int pakfire_xfer_set_size(struct pakfire_xfer* xfer, size_t size) {
+int pakfire_xfer_set_size(pakfire_xfer* xfer, size_t size) {
        xfer->expected_size = size;
 
        return 0;
 }
 
-int pakfire_xfer_verify_hashes(struct pakfire_xfer* self, const struct pakfire_hashes* hashes) {
+int pakfire_xfer_verify_hashes(pakfire_xfer* self, const struct pakfire_hashes* hashes) {
        return pakfire_hashes_import(&self->expected_hashes, hashes);
 }
 
-char* pakfire_xfer_escape(struct pakfire_xfer* self, const char* s) {
+char* pakfire_xfer_escape(pakfire_xfer* self, const char* s) {
        char* output = NULL;
        char* result = NULL;
 
@@ -590,7 +590,7 @@ char* pakfire_xfer_escape(struct pakfire_xfer* self, const char* s) {
        return result;
 }
 
-int pakfire_xfer_add_header(struct pakfire_xfer* self, const char* format, ...) {
+int pakfire_xfer_add_header(pakfire_xfer* self, const char* format, ...) {
        char* header = NULL;
        va_list args;
        int r;
@@ -616,7 +616,7 @@ ERROR:
        return r;
 }
 
-int pakfire_xfer_add_query(struct pakfire_xfer* xfer,
+int pakfire_xfer_add_query(pakfire_xfer* xfer,
                const char* key, const char* format, ...) {
        char* value = NULL;
        va_list args;
@@ -639,7 +639,7 @@ int pakfire_xfer_add_query(struct pakfire_xfer* xfer,
        return r;
 }
 
-int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload) {
+int pakfire_xfer_set_payload(pakfire_xfer* self, const char* payload) {
        if (self->payload) {
                free(self->payload);
                self->payload = NULL;
@@ -651,7 +651,7 @@ int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload) {
        return 0;
 }
 
-int pakfire_xfer_set_json_payload(struct pakfire_xfer* self, struct json_object* json) {
+int pakfire_xfer_set_json_payload(pakfire_xfer* self, struct json_object* json) {
        const char* s = NULL;
        int r;
 
@@ -669,14 +669,14 @@ int pakfire_xfer_set_json_payload(struct pakfire_xfer* self, struct json_object*
        return pakfire_xfer_set_payload(self, s);
 }
 
-static void pakfire_xfer_reset_output(struct pakfire_xfer* xfer) {
+static void pakfire_xfer_reset_output(pakfire_xfer* xfer) {
        if (xfer->fin) {
                fclose(xfer->fin);
                xfer->fin = NULL;
        }
 }
 
-int pakfire_xfer_set_output(struct pakfire_xfer* xfer, FILE* f) {
+int pakfire_xfer_set_output(pakfire_xfer* xfer, FILE* f) {
        pakfire_xfer_reset_output(xfer);
 
        // Store the new stream
@@ -685,7 +685,7 @@ int pakfire_xfer_set_output(struct pakfire_xfer* xfer, FILE* f) {
        return 0;
 }
 
-int pakfire_xfer_set_output_buffer(struct pakfire_xfer* xfer,
+int pakfire_xfer_set_output_buffer(pakfire_xfer* xfer,
                char** buffer, size_t* length) {
        FILE* f = NULL;
 
@@ -699,7 +699,7 @@ int pakfire_xfer_set_output_buffer(struct pakfire_xfer* xfer,
        return pakfire_xfer_set_output(xfer, f);
 }
 
-int pakfire_xfer_set_response_callback(struct pakfire_xfer* self,
+int pakfire_xfer_set_response_callback(pakfire_xfer* self,
                pakfire_xfer_response_callback callback, void* data) {
        int r;
 
@@ -787,7 +787,7 @@ int pakfire_xfer_response_get_error(const pakfire_xfer_response* response, char*
        return 0;
 }
 
-int pakfire_xfer_set_input(struct pakfire_xfer* xfer, FILE* f) {
+int pakfire_xfer_set_input(pakfire_xfer* xfer, FILE* f) {
        struct stat stat;
        int r;
 
@@ -818,7 +818,7 @@ int pakfire_xfer_set_input(struct pakfire_xfer* xfer, FILE* f) {
        return 0;
 }
 
-static int pakfire_xfer_allocate_tmpfile_legacy(struct pakfire_xfer* xfer, const char* path) {
+static int pakfire_xfer_allocate_tmpfile_legacy(pakfire_xfer* xfer, const char* path) {
        FILE* f = NULL;
        int r;
 
@@ -839,7 +839,7 @@ static int pakfire_xfer_allocate_tmpfile_legacy(struct pakfire_xfer* xfer, const
        return pakfire_xfer_set_output(xfer, f);
 }
 
-static int pakfire_xfer_allocate_tmpfile(struct pakfire_xfer* xfer, const char* path) {
+static int pakfire_xfer_allocate_tmpfile(pakfire_xfer* xfer, const char* path) {
        char dirname[PATH_MAX];
        FILE* f = NULL;
        int fd = -1;
@@ -879,7 +879,7 @@ static int pakfire_xfer_allocate_tmpfile(struct pakfire_xfer* xfer, const char*
        return pakfire_xfer_set_output(xfer, f);
 }
 
-int pakfire_xfer_set_output_path(struct pakfire_xfer* xfer, const char* path) {
+int pakfire_xfer_set_output_path(pakfire_xfer* xfer, const char* path) {
        int r;
 
        // Store the output path
@@ -984,7 +984,7 @@ static pakfire_xfer_error_code_t pakfire_xfer_code(CURLcode code, int http_statu
 /*
        Called after something went wrong and we want to try again with another mirror
 */
-static int pakfire_xfer_next_mirror(struct pakfire_xfer* xfer) {
+static int pakfire_xfer_next_mirror(pakfire_xfer* xfer) {
        pakfire_mirror* mirror = NULL;
        int r = 0;
 
@@ -1006,7 +1006,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_xfer_call_response_callback(struct pakfire_xfer* self, pakfire_xfer_error_code_t error, int status) {
+static int pakfire_xfer_call_response_callback(pakfire_xfer* self, pakfire_xfer_error_code_t error, int status) {
        char* e = NULL;
        int r;
 
@@ -1044,7 +1044,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_xfer_fail(struct pakfire_xfer* xfer, pakfire_xfer_error_code_t code, int status) {
+static int pakfire_xfer_fail(pakfire_xfer* xfer, pakfire_xfer_error_code_t code, int status) {
        int r;
 
        // Drop the hasher
@@ -1128,7 +1128,7 @@ static const char* curl_http_version(long v) {
        return "unknown";
 }
 
-static int pakfire_xfer_socket_send(struct pakfire_xfer* self) {
+static int pakfire_xfer_socket_send(pakfire_xfer* self) {
        int r;
 
        // The socket is now ready to send
@@ -1154,7 +1154,7 @@ static int pakfire_xfer_socket_send(struct pakfire_xfer* self) {
        return 0;
 }
 
-static int pakfire_xfer_socket_recv(struct pakfire_xfer* xfer) {
+static int pakfire_xfer_socket_recv(pakfire_xfer* xfer) {
        const struct curl_ws_frame* meta = NULL;
        char buffer[4096];
        int r;
@@ -1227,7 +1227,7 @@ ERROR:
 }
 
 static int __pakfire_xfer_socket(sd_event_source* s, int fd, uint32_t events, void* data) {
-       struct pakfire_xfer* xfer = data;
+       pakfire_xfer* xfer = data;
        int r;
 
        // Is there any data to read?
@@ -1252,7 +1252,7 @@ static int __pakfire_xfer_socket(sd_event_source* s, int fd, uint32_t events, vo
        send or receive data.
 */
 static pakfire_xfer_error_code_t pakfire_xfer_done_socket(
-               struct pakfire_xfer* xfer, sd_event* loop, int code) {
+               pakfire_xfer* xfer, sd_event* loop, int code) {
        curl_socket_t socket = -1;
        int events = 0;
        int r;
@@ -1303,7 +1303,7 @@ ERROR:
 /*
        This function checks if the hashes match (if set up)
 */
-static int pakfire_xfer_verify(struct pakfire_xfer* self) {
+static int pakfire_xfer_verify(pakfire_xfer* self) {
        struct pakfire_hashes computed_hashes = {};
        int r;
 
@@ -1344,7 +1344,7 @@ static int pakfire_xfer_verify(struct pakfire_xfer* self) {
        }
 }
 
-static int pakfire_xfer_save(struct pakfire_xfer* xfer, int status) {
+static int pakfire_xfer_save(pakfire_xfer* xfer, int status) {
        int fd = -EBADF;
        int r;
 
@@ -1399,7 +1399,7 @@ static int pakfire_xfer_save(struct pakfire_xfer* xfer, int status) {
 }
 
 pakfire_xfer_error_code_t pakfire_xfer_done(
-               struct pakfire_xfer* xfer, sd_event* loop, int code) {
+               pakfire_xfer* xfer, sd_event* loop, int code) {
        CURL* h = xfer->handle;
        int r;
        const char* scheme = NULL;
@@ -1526,7 +1526,7 @@ pakfire_xfer_error_code_t pakfire_xfer_done(
 
 static int pakfire_xfer_update(void* data,
                curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) {
-       struct pakfire_xfer* xfer = data;
+       pakfire_xfer* xfer = data;
 
        switch (xfer->direction) {
                case PAKFIRE_XFER_DOWNLOAD:
@@ -1560,7 +1560,7 @@ static int pakfire_xfer_update(void* data,
        return pakfire_progress_update(xfer->progress, xfer->xferred);
 }
 
-static int pakfire_xfer_prepare_progress(struct pakfire_xfer* xfer,
+static int pakfire_xfer_prepare_progress(pakfire_xfer* xfer,
                pakfire_progress* parent, int flags) {
        const char* title = NULL;
        int progress_flags =
@@ -1609,7 +1609,7 @@ static int pakfire_xfer_prepare_progress(struct pakfire_xfer* xfer,
        return 0;
 }
 
-static int pakfire_xfer_prepare_url(struct pakfire_xfer* xfer) {
+static int pakfire_xfer_prepare_url(pakfire_xfer* xfer) {
        int r;
 
        // If this has been called before, we free the former object
@@ -1702,7 +1702,7 @@ ERROR:
        return r;
 }
 
-int pakfire_xfer_prepare(struct pakfire_xfer* xfer, pakfire_progress* progress, int flags) {
+int pakfire_xfer_prepare(pakfire_xfer* xfer, pakfire_progress* progress, int flags) {
        int r;
 
        // Increment tries
@@ -1783,7 +1783,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, pakfire_progress* progress,
        return 0;
 }
 
-int pakfire_xfer_socket(struct pakfire_xfer* xfer, pakfire_xfer_open_callback open,
+int pakfire_xfer_socket(pakfire_xfer* xfer, pakfire_xfer_open_callback open,
                pakfire_xfer_recv_callback recv, pakfire_xfer_send_callback send,
                pakfire_xfer_close_callback close, void* data) {
        xfer->direction = PAKFIRE_XFER_SOCKET;
@@ -1801,7 +1801,7 @@ int pakfire_xfer_socket(struct pakfire_xfer* xfer, pakfire_xfer_open_callback op
 /*
        This function sends a WebSocket message
 */
-static int __pakfire_xfer_send_message(struct pakfire_xfer* xfer,
+static int __pakfire_xfer_send_message(pakfire_xfer* xfer,
                const char* message, const size_t length) {
        size_t bytes_sent = 0;
        size_t offset = 0;
@@ -1842,7 +1842,7 @@ static int __pakfire_xfer_send_message(struct pakfire_xfer* xfer,
        return r;
 }
 
-int pakfire_xfer_send_message(struct pakfire_xfer* self,
+int pakfire_xfer_send_message(pakfire_xfer* self,
                const char* message, const size_t length) {
        int r;
 
@@ -1862,7 +1862,7 @@ int pakfire_xfer_send_message(struct pakfire_xfer* self,
        return __pakfire_xfer_send_message(self, message, length);
 }
 
-int pakfire_xfer_is_ready_to_send(struct pakfire_xfer* self) {
+int pakfire_xfer_is_ready_to_send(pakfire_xfer* self) {
        // This function is only supported for sockets
        switch (self->direction) {
                case PAKFIRE_XFER_SOCKET:
@@ -1875,7 +1875,7 @@ int pakfire_xfer_is_ready_to_send(struct pakfire_xfer* self) {
        return (self->state & PAKFIRE_XFER_READY_TO_SEND);
 }
 
-pakfire_xfer_error_code_t pakfire_xfer_run(struct pakfire_xfer* xfer, int flags) {
+pakfire_xfer_error_code_t pakfire_xfer_run(pakfire_xfer* xfer, int flags) {
        int r;
 
        // Prepare the xfer
index f1ddc4f390ab51f8cecd998b78bc4e400704124a..8c411ef8ee6e20143d12ec84b11bd2fd5a194a72 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <systemd/sd-event.h>
 
-struct pakfire_xfer;
+typedef struct pakfire_xfer pakfire_xfer;
 
 typedef enum pakfire_xfer_error_code {
        PAKFIRE_XFER_OK = 0,
@@ -95,77 +95,77 @@ typedef enum pakfire_transfer_method {
 } pakfire_xfer_method_t;
 
 int pakfire_xfer_create_simple(
-       struct pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url);
+       pakfire_xfer** xfer, pakfire_ctx* ctx, const char* url);
 
-int pakfire_xfer_create(struct pakfire_xfer** xfer, pakfire_ctx* ctx,
+int pakfire_xfer_create(pakfire_xfer** xfer, pakfire_ctx* ctx,
        const char* url, va_list args) __attribute__((format(printf, 3, 0)));
 
-struct pakfire_xfer* pakfire_xfer_ref(struct pakfire_xfer* xfer);
-struct pakfire_xfer* pakfire_xfer_unref(struct pakfire_xfer* xfer);
+pakfire_xfer* pakfire_xfer_ref(pakfire_xfer* xfer);
+pakfire_xfer* pakfire_xfer_unref(pakfire_xfer* xfer);
 
-CURL* pakfire_xfer_handle(struct pakfire_xfer* xfer);
+CURL* pakfire_xfer_handle(pakfire_xfer* xfer);
 
-int pakfire_xfer_set_method(struct pakfire_xfer* xfer,
+int pakfire_xfer_set_method(pakfire_xfer* xfer,
        const pakfire_xfer_method_t method);
 
 // Title
-const char* pakfire_xfer_get_title(struct pakfire_xfer* xfer);
-int pakfire_xfer_set_title(struct pakfire_xfer* xfer, const char* title);
+const char* pakfire_xfer_get_title(pakfire_xfer* xfer);
+int pakfire_xfer_set_title(pakfire_xfer* xfer, const char* title);
 
-int pakfire_xfer_set_baseurl(struct pakfire_xfer* xfer, const char* baseurl);
-const char* pakfire_xfer_get_effective_url(struct pakfire_xfer* xfer);
+int pakfire_xfer_set_baseurl(pakfire_xfer* xfer, const char* baseurl);
+const char* pakfire_xfer_get_effective_url(pakfire_xfer* xfer);
 
-int pakfire_xfer_set_mirrorlist(struct pakfire_xfer* xfer, pakfire_mirrorlist* mirrors);
+int pakfire_xfer_set_mirrorlist(pakfire_xfer* xfer, pakfire_mirrorlist* mirrors);
 
-size_t pakfire_xfer_get_size(struct pakfire_xfer* xfer);
-int pakfire_xfer_set_size(struct pakfire_xfer* xfer, size_t size);
+size_t pakfire_xfer_get_size(pakfire_xfer* xfer);
+int pakfire_xfer_set_size(pakfire_xfer* xfer, size_t size);
 
-int pakfire_xfer_verify_hashes(struct pakfire_xfer* self, const struct pakfire_hashes* hashes);
+int pakfire_xfer_verify_hashes(pakfire_xfer* self, const struct pakfire_hashes* hashes);
 
-char* pakfire_xfer_escape(struct pakfire_xfer* self, const char* s);
+char* pakfire_xfer_escape(pakfire_xfer* self, const char* s);
 
-int pakfire_xfer_add_header(struct pakfire_xfer* self, const char* format, ...)
+int pakfire_xfer_add_header(pakfire_xfer* self, const char* format, ...)
        __attribute__((format(printf, 2, 3)));
-int pakfire_xfer_add_query(struct pakfire_xfer* xfer,
+int pakfire_xfer_add_query(pakfire_xfer* xfer,
        const char* key, const char* format, ...) __attribute__((format(printf, 3, 4)));
 
 // Payload
-int pakfire_xfer_set_payload(struct pakfire_xfer* self, const char* payload);
-int pakfire_xfer_set_json_payload(struct pakfire_xfer* self, struct json_object* json);
+int pakfire_xfer_set_payload(pakfire_xfer* self, const char* payload);
+int pakfire_xfer_set_json_payload(pakfire_xfer* self, struct json_object* json);
 
 // Output
-int pakfire_xfer_set_output(struct pakfire_xfer* xfer, FILE* f);
-int pakfire_xfer_set_output_buffer(struct pakfire_xfer* xfer, char** buffer, size_t* length);
-int pakfire_xfer_set_output_path(struct pakfire_xfer* xfer, const char* path);
+int pakfire_xfer_set_output(pakfire_xfer* xfer, FILE* f);
+int pakfire_xfer_set_output_buffer(pakfire_xfer* xfer, char** buffer, size_t* length);
+int pakfire_xfer_set_output_path(pakfire_xfer* xfer, const char* path);
 
 // Response
 
 typedef int (*pakfire_xfer_response_callback)
-       (struct pakfire_xfer* xfer, const pakfire_xfer_response* response, void* data);
+       (pakfire_xfer* xfer, const pakfire_xfer_response* response, void* data);
 
-int pakfire_xfer_set_response_callback(struct pakfire_xfer* xfer,
+int pakfire_xfer_set_response_callback(pakfire_xfer* xfer,
        pakfire_xfer_response_callback callback, void* data);
 
 int pakfire_xfer_response_get_error(const pakfire_xfer_response* response, char** error);
 
 // Input
-int pakfire_xfer_set_input(struct pakfire_xfer* xfer, FILE* f);
+int pakfire_xfer_set_input(pakfire_xfer* xfer, FILE* f);
 
-int pakfire_xfer_prepare(struct pakfire_xfer* xfer, pakfire_progress* progress, int flags);
-pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, sd_event* loop, int code);
+int pakfire_xfer_prepare(pakfire_xfer* xfer, pakfire_progress* progress, int flags);
+pakfire_xfer_error_code_t pakfire_xfer_done(pakfire_xfer* xfer, sd_event* loop, int code);
 
-pakfire_xfer_error_code_t pakfire_xfer_run(struct pakfire_xfer* xfer, int flags);
+pakfire_xfer_error_code_t pakfire_xfer_run(pakfire_xfer* xfer, int flags);
 
 // WebSocket
-typedef int (*pakfire_xfer_open_callback)(struct pakfire_xfer* xfer, void* data);
-typedef int (*pakfire_xfer_recv_callback)(struct pakfire_xfer* xfer, const char* message, const size_t size, void* data);
-typedef int (*pakfire_xfer_send_callback)(struct pakfire_xfer* xfer, void* data);
-typedef int (*pakfire_xfer_close_callback)(struct pakfire_xfer* xfer, int code, void* data);
+typedef int (*pakfire_xfer_open_callback)(pakfire_xfer* xfer, void* data);
+typedef int (*pakfire_xfer_recv_callback)(pakfire_xfer* xfer, const char* message, const size_t size, void* data);
+typedef int (*pakfire_xfer_send_callback)(pakfire_xfer* xfer, void* data);
+typedef int (*pakfire_xfer_close_callback)(pakfire_xfer* xfer, int code, void* data);
 
-int pakfire_xfer_socket(struct pakfire_xfer* xfer, pakfire_xfer_open_callback open,
+int pakfire_xfer_socket(pakfire_xfer* xfer, pakfire_xfer_open_callback open,
        pakfire_xfer_recv_callback recv, pakfire_xfer_send_callback send, pakfire_xfer_close_callback close, void* data);
 
-int pakfire_xfer_send_message(struct pakfire_xfer* xfer, const char* message, const size_t length);
-int pakfire_xfer_is_ready_to_send(struct pakfire_xfer* self);
+int pakfire_xfer_send_message(pakfire_xfer* xfer, const char* message, const size_t length);
+int pakfire_xfer_is_ready_to_send(pakfire_xfer* self);
 
 #endif /* PAKFIRE_XFER_H */
index 0ab316f85838fdafac9fee41d7c8202e602633b3..a29e7c62cbdbb61b16fde16d2da837837389f3b8 100644 (file)
@@ -44,7 +44,7 @@ FAIL:
 }
 
 static int test_one(const struct test* t) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char* buffer = NULL;
        size_t length = 0;
        int r = EXIT_FAILURE;
@@ -73,10 +73,10 @@ FAIL:
        return r;
 }
 
-static int __test_create_transfer(const struct test* t, struct pakfire_xfer** xfer,
+static int __test_create_transfer(const struct test* t, pakfire_xfer** xfer,
        char** buffer, size_t* length, const char* url, ...) __attribute__((format(printf, 5, 6)));
 
-static int __test_create_transfer(const struct test* t, struct pakfire_xfer** xfer,
+static int __test_create_transfer(const struct test* t, pakfire_xfer** xfer,
                char** buffer, size_t* length, const char* url, ...) {
        va_list args;
        int r;
@@ -105,16 +105,16 @@ ERROR:
 }
 
 static int test_multiple(const struct test* t) {
-       struct pakfire_xfer* xfer1 = NULL;
+       pakfire_xfer* xfer1 = NULL;
        char* buffer1 = NULL;
        size_t length1 = 0;
-       struct pakfire_xfer* xfer2 = NULL;
+       pakfire_xfer* xfer2 = NULL;
        char* buffer2 = NULL;
        size_t length2 = 0;
-       struct pakfire_xfer* xfer3 = NULL;
+       pakfire_xfer* xfer3 = NULL;
        char* buffer3 = NULL;
        size_t length3 = 0;
-       struct pakfire_xfer* xfer4 = NULL;
+       pakfire_xfer* xfer4 = NULL;
        char* buffer4 = NULL;
        size_t length4 = 0;
        int r = EXIT_FAILURE;
index e8eb405f0d5b7f472ee9acbc626525b75c035453..361b52363a7a0883c0d6d236b260eb25df9f93b3 100644 (file)
@@ -40,7 +40,7 @@ static const unsigned char RANDOM_FILE_sha2_512[] = {
 };
 
 static int test_create(const struct test* t) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r = EXIT_FAILURE;
 
        // Create a new transfer
@@ -57,7 +57,7 @@ FAIL:
 }
 
 static int test_download(const struct test* t) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r = EXIT_FAILURE;
 
        // Create a new transfer
@@ -77,7 +77,7 @@ FAIL:
 }
 
 static int test_download_into_buffer(const struct test* t) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char* buffer = NULL;
        size_t length = 0;
        int r = EXIT_FAILURE;
@@ -109,7 +109,7 @@ FAIL:
 
 static int test_download_check_digest(const struct test* t) {
        struct pakfire_hashes hashes = {};
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char* buffer = NULL;
        size_t length = 0;
        int r = EXIT_FAILURE;
@@ -147,7 +147,7 @@ FAIL:
 
 static int test_download_check_incorrect_digest(const struct test* t) {
        struct pakfire_hashes hashes = {};
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        char* buffer = NULL;
        size_t length = 0;
        int r = EXIT_FAILURE;
@@ -182,7 +182,7 @@ FAIL:
 
 #ifdef ENABLE_ONLINE_TESTS
 static int test_online_download(const struct test* t) {
-       struct pakfire_xfer* xfer = NULL;
+       pakfire_xfer* xfer = NULL;
        int r = EXIT_FAILURE;
 
        // Create a new transfer