diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-06 20:41:47 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-06 20:41:47 +0800 |
commit | ee08b2235cf2fefdb48eafde9990babaca4b4495 (patch) | |
tree | fe79fa63abd5dc10bc6ab8143cafebcca69ee0c4 | |
parent | 1309b6615004bd993506f0e71333d50599220e53 (diff) |
Simplify list length syntax
-rw-r--r-- | search.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -17,12 +17,13 @@ static size_t ticket_handler(void *contents, size_t size, size_t nmemb strcpy(lines, response); rtclient_search_ticket_list **listptr = (rtclient_search_ticket_list **)writedata; + rtclient_search_ticket_list *list = *listptr; char *line = strtok(response, "\n"); if (strstr(line, "200 Ok")) { line = strtok(NULL, "\n"); do { - (*listptr)->length++; + list->length++; if (!strcmp(line, "No matching results.")) { free(*listptr); *listptr = NULL; @@ -31,7 +32,7 @@ static size_t ticket_handler(void *contents, size_t size, size_t nmemb } while ((line = strtok(NULL, "\n"))); *listptr = realloc(*listptr, sizeof(rtclient_search_ticket_list) - + (*listptr)->length * sizeof(rtclient_ticket)); + + list->length * sizeof(rtclient_ticket)); rtclient_search_ticket_list *list = *listptr; char *linesaveptr = NULL; |