From ee08b2235cf2fefdb48eafde9990babaca4b4495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Sun, 6 Oct 2019 20:41:47 +0800 Subject: Simplify list length syntax --- search.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/search.c b/search.c index 1de25f0..83af684 100644 --- a/search.c +++ b/search.c @@ -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; -- cgit v1.2.3