From ffb19795841375a97e94eb3f0ca295a6bd270106 Mon Sep 17 00:00:00 2001 From: awy Date: Sun, 24 Aug 2025 00:10:12 +0300 Subject: json fixes --- src/sttorrent.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3