summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-08-24 00:10:12 +0300
committerawy <awy@awy.one>2025-08-24 00:10:12 +0300
commitffb19795841375a97e94eb3f0ca295a6bd270106 (patch)
treefb1475089c80452fe42f9486934fdcf8b0ef5f98 /src
parent96b0596c8c9caa28040439e8e5389494406f331f (diff)
json fixes
Diffstat (limited to 'src')
-rw-r--r--src/sttorrent.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sttorrent.c b/src/sttorrent.c
index a911071..72dd2e4 100644
--- a/src/sttorrent.c
+++ b/src/sttorrent.c
@@ -96,7 +96,7 @@ main(void)
char id[75];
CURL* handle;
CURLcode res;
- cJSON *torrents;
+ cJSON *root, *arguments, *status,*torrents;
int status_count[7] = {0};
struct MemoryStruct chunk;
struct curl_slist *headers = NULL;
@@ -129,7 +129,7 @@ main(void)
if (res != CURLE_OK) { return 1; }
/* JSON parsing */
- torrents = cJSON_Parse(chunk.memory);
+ root = cJSON_Parse(chunk.memory);
/* Cleanup */
curl_easy_cleanup(handle);
@@ -137,11 +137,11 @@ main(void)
free(chunk.memory);
curl_global_cleanup();
- torrents = cJSON_GetObjectItem(torrents, "arguments");
- torrents = cJSON_GetObjectItem(torrents, "torrents");
+ arguments = cJSON_GetObjectItem(root, "arguments");
+ torrents = cJSON_GetObjectItem(arguments, "torrents");
if (cJSON_GetArraySize(torrents) == 0) {
- cJSON_Delete(torrents);
+ cJSON_Delete(root);
return 0;
}
@@ -168,6 +168,6 @@ main(void)
printf("%d", status_count[i]);
}
- cJSON_Delete(torrents);
+ cJSON_Delete(root);
return 0;
}