diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 20:52:20 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 20:52:20 +0800 |
commit | 4c08aa1b1e04ac1b73217e13315da126b631c079 (patch) | |
tree | 2d3f295c335b2a59a900a555ab3ba1cfa6ac06fa /ticket.c | |
parent | 84207f6e0a54bdb8fb263ba4e0a90417e6352892 (diff) |
Ticket history free functions
Diffstat (limited to 'ticket.c')
-rw-r--r-- | ticket.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include "rtclient/ticket.h" typedef struct rtclient_ticket rtclient_ticket; +typedef struct rtclient_ticket_history_attachment rtclient_ticket_history_attachment; typedef struct rtclient_ticket_history_list rtclient_ticket_history_list; void rtclient_ticket_new(const char *queue @@ -247,3 +248,37 @@ void rtclient_ticket_history(rtclient_ticket_history_list **listptr request(history_handler, (void *)listptr, NULL, "%s%u%s" , "REST/1.0/ticket/", id, "/history?format=l"); } + +void rtclient_ticket_history_free(struct rtclient_ticket_history *history) +{ + if (history->attachments) { + for(size_t i = 0; i < history->attachments->length; i++) { + rtclient_ticket_history_attachment *attachment + = history->attachments->attachments[i]; + if (attachment->file_name) + free(attachment->file_name); + free(attachment); + } + free(history->attachments); + } + free(history->created); + free(history->creator); + free(history->content); + free(history->description); + if (history->data) + free(history->data); + if (history->new_value) + free(history->new_value); + if (history->old_value) + free(history->old_value); + free(history); + history = NULL; +} + +void rtclient_ticket_history_list_free(struct rtclient_ticket_history_list *list) +{ + for (size_t i = 0; i < list->length; i++) + rtclient_ticket_history_free(list->histories[i]); + free(list); + list = NULL; +} |