Cleanup functions
FossilOrigin-Name: ca5cc102d373cfc3a4eca86db921e45091dd1f2fe733020910ec703e39177143
This commit is contained in:
parent
ec2cd08e7e
commit
680b895807
9 changed files with 36 additions and 2 deletions
|
@ -39,6 +39,7 @@ struct mstdnt_attachment
|
|||
char* blurhash;
|
||||
};
|
||||
|
||||
void cleanup_attachments(struct mstdnt_attachment* attachment);
|
||||
void _mstdnt_val_attachments_call(cJSON* v, void* _type);
|
||||
|
||||
#endif /* MASTODONT_ATTACHMENT */
|
||||
|
|
|
@ -37,6 +37,8 @@ struct mstdnt_emoji_reaction
|
|||
/* TODO Accounts */
|
||||
};
|
||||
|
||||
void cleanup_emoji_reaction(struct mstdnt_emoji_reaction* reactions);
|
||||
void cleanup_emoji_reactions(struct mstdnt_emoji_reaction* reactions);
|
||||
void _mstdnt_val_emoji_reactions_call(cJSON* v, void* _type);
|
||||
|
||||
#endif /* MASTODONT_EMOJI */
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#ifndef MASTODONT_NOTIFICATION
|
||||
#define MASTODONT_NOTIFICATION
|
||||
#include "mastodont_types.h"
|
||||
#include <cjson/cJSON.h>
|
||||
|
||||
enum mstdnt_notification_type
|
||||
{
|
||||
|
@ -39,10 +40,10 @@ struct mstdnt_notification
|
|||
|
||||
int mastodont_notifications(mastodont_t* data,
|
||||
struct mstdnt_notification** notifs,
|
||||
stuct mstdnt_storage* storage,
|
||||
struct mstdnt_storage* storage,
|
||||
size_t* size);
|
||||
|
||||
int mstdnt_load_account_from_json(struct mstdnt_notification* notif, cJSON* js);
|
||||
void _mstdnt_val_notifications_call(cJSON* v, void* _type);
|
||||
|
||||
#endif // MASTODONT_NOTIFICATION
|
||||
#endif /* MASTODONT_NOTIFICATION */
|
||||
|
|
|
@ -34,6 +34,7 @@ struct mstdnt_status_pleroma
|
|||
int thread_muted;
|
||||
};
|
||||
|
||||
void cleanup_status_pleroma(struct mstdnt_status_pleroma* pleroma);
|
||||
int mstdnt_load_status_pleroma_from_json(struct mstdnt_status_pleroma* pleroma, cJSON* js);
|
||||
void _mstdnt_val_status_pleroma_call(cJSON* v, void* _type);
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ struct mstdnt_create_status_args
|
|||
char* visibility;
|
||||
};
|
||||
|
||||
void cleanup_status(struct mstdnt_status* status);
|
||||
|
||||
int mstdnt_load_statuses_from_result(struct mstdnt_status* status[],
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_fetch_results* results,
|
||||
|
|
|
@ -64,3 +64,8 @@ void _mstdnt_val_attachments_call(cJSON* v, void* _type)
|
|||
load_attachment_from_json((*attachments) + i, it->child);
|
||||
}
|
||||
}
|
||||
|
||||
void cleanup_attachments(struct mstdnt_attachment* attachment)
|
||||
{
|
||||
if (attachment) free(attachment);
|
||||
}
|
||||
|
|
10
src/emoji.c
10
src/emoji.c
|
@ -60,3 +60,13 @@ void _mstdnt_val_emoji_reactions_call(cJSON* v, void* _type)
|
|||
}
|
||||
}
|
||||
|
||||
void cleanup_emoji_reaction(struct mstdnt_emoji_reaction* reactions)
|
||||
{
|
||||
/* NOP for compatibility purposes */
|
||||
return;
|
||||
}
|
||||
|
||||
void cleanup_emoji_reactions(struct mstdnt_emoji_reaction* reactions)
|
||||
{
|
||||
if (reactions) free(reactions);
|
||||
}
|
||||
|
|
|
@ -47,3 +47,9 @@ void _mstdnt_val_status_pleroma_call(cJSON* v, void* _type)
|
|||
|
||||
mstdnt_load_status_pleroma_from_json(type, v->child);
|
||||
}
|
||||
|
||||
void cleanup_status_pleroma(struct mstdnt_status_pleroma* pleroma)
|
||||
{
|
||||
cleanup_emoji_reactions(pleroma->emoji_reactions);
|
||||
}
|
||||
|
||||
|
|
|
@ -339,3 +339,9 @@ cleanup:
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
void cleanup_status(struct mstdnt_status* status)
|
||||
{
|
||||
cleanup_attachments(status->media_attachments);
|
||||
cleanup_status_pleroma(&(status->pleroma));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue