From 7fbf4dc6b00a389dd87d32bbf18147fbb3af7b3f 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: Fri, 13 Sep 2019 11:17:26 +0800 Subject: Take out the subtoken variable declarations out from the loop --- rtclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtclient.c b/rtclient.c index f4abc90..454b53c 100644 --- a/rtclient.c +++ b/rtclient.c @@ -45,9 +45,9 @@ user_callback(void *contents, size_t size, size_t nmemb, void *writedata) char *line = strtok_r(response, "\n", &linesaveptr); if (strstr(line, "200 Ok")) { line = strtok_r(NULL, "\n", &linesaveptr); + char *tokensaveptr = NULL, *token = NULL; do { - char *tokensaveptr = NULL; - char *token = strtok_r(line, ":", &tokensaveptr); + token = strtok_r(line, ":", &tokensaveptr); if (!strcmp(token, "id")) { token = strtok_r(NULL, ":", &tokensaveptr); user->id = malloc(strlen(token)); -- cgit v1.2.3