summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-13 11:17:26 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-13 11:17:26 +0800
commit7fbf4dc6b00a389dd87d32bbf18147fbb3af7b3f (patch)
tree5814f0f6098d6639f8ad4bfc58e7c2807ce73c6e
parentc7ec01708af00c4edfe0fdf447ac6a19b741a91b (diff)
Take out the subtoken variable declarations out from the loop
-rw-r--r--rtclient.c4
1 files 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));