diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-30 11:02:05 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-30 11:02:05 +0800 |
commit | 3ba566924ebb019b084b3d0714ee51250828c4ce (patch) | |
tree | 0ce8071bbbf06041dff9abc57bf5c83a143a7d23 | |
parent | 7180c051d619f0605f2c45929eb516d28bcb709f (diff) |
Rename ticketlist to ticket_list
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | rtclient/ticket.h | 6 | ||||
-rw-r--r-- | ticket.c | 14 |
3 files changed, 11 insertions, 11 deletions
@@ -63,7 +63,7 @@ int main(void) , user->disabled); rtclient_user_free(user); - struct rtclient_ticketlist *list = NULL; + struct rtclient_ticket_list *list = NULL; static const char *prefix = "Owner='"; char query[strlen(prefix) + strlen(name) + 2]; sprintf(query, "%s%s'", prefix, name); diff --git a/rtclient/ticket.h b/rtclient/ticket.h index ae4f474..44d2245 100644 --- a/rtclient/ticket.h +++ b/rtclient/ticket.h @@ -6,7 +6,7 @@ struct rtclient_ticket { char *subject; }; -struct rtclient_ticketlist { +struct rtclient_ticket_list { size_t length; struct rtclient_ticket *tickets[]; }; @@ -29,10 +29,10 @@ extern "C" { , const char *starts , const char *due , const char *text); - void rtclient_ticket_search(struct rtclient_ticketlist **listptr + void rtclient_ticket_search(struct rtclient_ticket_list **listptr , const char *query); void rtclient_ticket_history(unsigned int id); - void rtclient_ticket_freelist(struct rtclient_ticketlist *list); + void rtclient_ticket_freelist(struct rtclient_ticket_list *list); #ifdef __cplusplus } @@ -3,7 +3,7 @@ #include "rtclient/ticket.h" typedef struct rtclient_ticket rtclient_ticket; -typedef struct rtclient_ticketlist rtclient_ticketlist; +typedef struct rtclient_ticket_list rtclient_ticket_list; void rtclient_ticket_new(const char *queue , const char *requestor @@ -48,7 +48,7 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb response[realsize] = '\0'; char lines[strlen(response) + 1]; strcpy(lines, response); - rtclient_ticketlist **listptr = (rtclient_ticketlist **)writedata; + rtclient_ticket_list **listptr = (rtclient_ticket_list **)writedata; char *line = strtok(response, "\n"); if (strstr(line, "200 Ok")) { @@ -62,10 +62,10 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb } } while ((line = strtok(NULL, "\n"))); - rtclient_ticketlist *ptr = realloc(*listptr, sizeof(*listptr) + rtclient_ticket_list *ptr = realloc(*listptr, sizeof(*listptr) + (*listptr)->length * sizeof(rtclient_ticket)); *listptr = ptr; - rtclient_ticketlist *list = *listptr; + rtclient_ticket_list *list = *listptr; char *linesaveptr = NULL; line = strtok_r(lines, "\n", &linesaveptr); @@ -97,9 +97,9 @@ static size_t search_callback(void *contents, size_t size, size_t nmemb return realsize; } -void rtclient_ticket_search(rtclient_ticketlist **listptr, const char *query) +void rtclient_ticket_search(rtclient_ticket_list **listptr, const char *query) { - *listptr = malloc(sizeof(rtclient_ticketlist)); + *listptr = malloc(sizeof(rtclient_ticket_list)); (*listptr)->length = 0; request(search_callback, (void *)listptr, NULL, "%s%s" , "REST/1.0/search/ticket?query=", query); @@ -111,7 +111,7 @@ void rtclient_ticket_history(unsigned int id) , "/history?format=l"); } -void rtclient_ticket_freelist(rtclient_ticketlist *list) +void rtclient_ticket_freelist(rtclient_ticket_list *list) { for (size_t i = 0; i < list->length; i++) { rtclient_ticket *ticket = list->tickets[i]; |