From 5d4943f0931dc3b84909ac3d5c6f652c1bd07e80 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 4 Apr 2022 19:17:31 +0000 Subject: [PATCH] Rename "status" to "reblog" FossilOrigin-Name: f04d52ef096ff9cc2dcad28b2916ebe03cc0b8bf48f82adbab6fc65ca1ba2320 --- include/mastodont_status.h | 2 +- src/status.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/mastodont_status.h b/include/mastodont_status.h index 20219d0..cfb24d6 100644 --- a/include/mastodont_status.h +++ b/include/mastodont_status.h @@ -60,7 +60,7 @@ struct mstdnt_status char* url; char* in_reply_to_id; char* in_reply_to_account_id; - struct mstdnt_status* status; + struct mstdnt_status* reblog; struct mstdnt_poll* poll; struct mstdnt_card* card; char* language; diff --git a/src/status.c b/src/status.c index 42930f6..9c9fcdc 100644 --- a/src/status.c +++ b/src/status.c @@ -34,6 +34,10 @@ void _mstdnt_val_malloc_status_call(cJSON* v, void* _type) { struct mstdnt_status** type = _type; + /* Status value may be NULL */ + if (!(v->child)) + return; + *type = calloc(1, sizeof(struct mstdnt_status)); if (*type) @@ -73,7 +77,8 @@ int mstdnt_status_from_json(struct mstdnt_status* status, cJSON* js) { "favourites_count", &(status->favourites_count), _mstdnt_val_uint_call }, { "replies_count", &(status->replies_count), _mstdnt_val_uint_call }, { "media_attachments", &att_args, _mstdnt_val_attachments_call }, - { "pleroma", &(status->pleroma), _mstdnt_val_status_pleroma_call } + { "pleroma", &(status->pleroma), _mstdnt_val_status_pleroma_call }, + { "reblog", &(status->reblog), _mstdnt_val_malloc_status_call } }; for (v = js; v; v = v->next) @@ -422,6 +427,8 @@ void mstdnt_cleanup_status(struct mstdnt_status* status) { cleanup_attachments(status->media_attachments); cleanup_status_pleroma(&(status->pleroma)); + if (status->reblog) + free(status->reblog); } void mstdnt_cleanup_statuses(struct mstdnt_status* statuses, size_t s)