Update statuses callback
FossilOrigin-Name: 502e0482d2964dc8f934c2d5a1cbc2a9366af1691db18670c6d74db46ab2773e
This commit is contained in:
parent
e561cb1847
commit
ac4529348d
5 changed files with 15 additions and 9 deletions
|
@ -58,6 +58,4 @@ void mstdnt_cleanup(mastodont_t* data);
|
|||
*/
|
||||
void mstdnt_storage_cleanup(struct mstdnt_storage* storage);
|
||||
|
||||
void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data);
|
||||
|
||||
#endif /* MASTODONT_H */
|
||||
|
|
|
@ -95,4 +95,6 @@ int mstdnt_await(mastodont_t* mstdnt,
|
|||
struct mstdnt_fd extra_fds[],
|
||||
size_t nfds);
|
||||
|
||||
void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data);
|
||||
|
||||
#endif /* MASTODONT_FETCH_H */
|
||||
|
|
11
src/fetch.c
11
src/fetch.c
|
@ -87,6 +87,7 @@ int mstdnt_fetch_curl_async(mastodont_t* mstdnt,
|
|||
}
|
||||
results->callback = cb_request;
|
||||
results->callback_args = cb_args;
|
||||
|
||||
results->json_cb = json_cb;
|
||||
results->json_args = json_args;
|
||||
|
||||
|
@ -192,6 +193,7 @@ int mstdnt_await(mastodont_t* mstdnt,
|
|||
data->callback(&(results), data->callback_args);
|
||||
|
||||
cleanup_res:
|
||||
mstdnt_request_cb_cleanup(&results);
|
||||
// Cleanup
|
||||
mstdnt_fetch_data_cleanup(data);
|
||||
curl_multi_remove_handle(mstdnt->curl, msg->easy_handle);
|
||||
|
@ -212,3 +214,12 @@ int mstdnt_await(mastodont_t* mstdnt,
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
void mstdnt_storage_cleanup(struct mstdnt_storage* storage);
|
||||
|
||||
void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data)
|
||||
{
|
||||
mstdnt_storage_cleanup(data->storage);
|
||||
//data->data_free_cb(data->data, 0);
|
||||
/* free(data); */
|
||||
}
|
||||
|
|
|
@ -33,10 +33,3 @@ void mstdnt_storage_cleanup(struct mstdnt_storage* storage)
|
|||
storage->needs_cleanup = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data)
|
||||
{
|
||||
mstdnt_storage_cleanup(data->storage);
|
||||
//data->data_free_cb(data->data, 0);
|
||||
/* free(data); */
|
||||
}
|
||||
|
|
|
@ -149,6 +149,8 @@ GENERATE_JSON_ARRAY_FUNC(mstdnt_statuses_json, struct mstdnt_status, mstdnt_stat
|
|||
int mstdnt_statuses_json_callback(cJSON* json, void* args, mstdnt_request_cb_data* data)
|
||||
{
|
||||
struct mstdnt_statuses* statuses = malloc(sizeof(struct mstdnt_statuses));
|
||||
data->data = statuses;
|
||||
data->data_free_cb = (data_free_cb_t)mstdnt_cleanup_statuses;
|
||||
return mstdnt_statuses_json(&(statuses->statuses), &(statuses->len), json);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue