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