From 44b1e64c67b80ae5096b6b90b1f9860269902e2c Mon Sep 17 00:00:00 2001 From: nekobit Date: Thu, 17 Nov 2022 15:16:19 +0000 Subject: [PATCH] Reorder types FossilOrigin-Name: 5ac9b193a96fc57be698387fa2acf7cb6fb73ce496c91599ad6d796b032b3368 --- include/mastodont_types.h | 30 +++++++++++++++--------------- src/fetch.c | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/mastodont_types.h b/include/mastodont_types.h index fa4224b..75f835d 100644 --- a/include/mastodont_types.h +++ b/include/mastodont_types.h @@ -17,21 +17,6 @@ typedef int8_t mstdnt_bool; #define MSTDNT_FALSE 1 #define MSTDNT_BOOL_UNSET 0 -struct mstdnt_storage; - -typedef void (*mstdnt_data_free_cb_t)(void*); - -typedef struct mstdnt_request_cb_data { - struct mstdnt_storage storage; - cJSON* root; - struct mstdnt_fetch_data* fetch_data; - - void* data; - mstdnt_data_free_cb_t data_free_cb; -} mstdnt_request_cb_data; - -typedef int (*mstdnt_request_cb_t)(mstdnt_request_cb_data* data, void* args); - // Return types for mstdnt_request_cb_t, specifies // what we want to do with the data typedef enum mstdnt_enum_req @@ -67,6 +52,21 @@ struct mstdnt_args uint8_t flags; }; +struct mstdnt_storage; + +typedef void (*mstdnt_data_free_cb_t)(void*); + +typedef struct mstdnt_request_cb_data { + struct mstdnt_storage storage; + cJSON* root; + struct mstdnt_fetch_data* fetch_data; + + void* data; + mstdnt_data_free_cb_t data_free_cb; +} mstdnt_request_cb_data; + +typedef int (*mstdnt_request_cb_t)(mstdnt_request_cb_data* data, void* args); + struct mstdnt_file { char* file; diff --git a/src/fetch.c b/src/fetch.c index dc7efba..3e1aef2 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -141,7 +141,7 @@ int mstdnt_await(mastodont_t* mstdnt, // Data used with response, must keep it with request struct mstdnt_fetch_data* data; // Data that the user will work with - mstdnt_request_cb_data* results = calloc(1, mstdnt_request_cb_data); + mstdnt_request_cb_data* results = calloc(1, sizeof(mstdnt_request_cb_data)); results->fetch_data = data; // So we can clean it up // Check if our socket is done