diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2020-12-19 00:31:40 +0100 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2020-12-19 00:31:40 +0100 |
commit | 79e6835eb9478680530e66e12dc365993a08b788 (patch) | |
tree | 477a96ea6f0ae70df4c1c0daa3e3dcfc3337bcc3 /src/net.c | |
parent | 24288734e78aa2242b86dde8c770278fa1f5e05c (diff) | |
download | polecat-79e6835eb9478680530e66e12dc365993a08b788.tar.gz polecat-79e6835eb9478680530e66e12dc365993a08b788.zip |
remove useless struct, add json length type macro
- previously used progress struct was a leftover from when libcurl examples were used
- json_object_array_length returns int pre 0.13 and site_t on any other version
Diffstat (limited to 'src/net.c')
-rw-r--r-- | src/net.c | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -10,11 +10,6 @@ #include "net.h" #include "common.h" -struct progress { - TIMETYPE lastruntime; - CURL *curl; -}; - static size_t memoryCallback(void* contents, size_t size, size_t nmemb, void* userp) { size_t realsize = size * nmemb; @@ -35,14 +30,8 @@ static size_t memoryCallback(void* contents, size_t size, size_t nmemb, void* us return realsize; } -static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, UNUSED curl_off_t ultotal, UNUSED curl_off_t ulnow) +static int xferinfo(UNUSED void *p, curl_off_t dltotal, curl_off_t dlnow, UNUSED curl_off_t ultotal, UNUSED curl_off_t ulnow) { - struct progress *myp = (struct progress *)p; - CURL *curl = myp->curl; - TIMETYPE curtime = 0; - - curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &curtime); - curl_off_t progress = 0; if (dltotal != 0) progress = ((float)dlnow / dltotal) * 100; @@ -58,7 +47,6 @@ struct MemoryStruct* downloadToRam(const char* URL, long noprogress) { CURL* curl_handle; CURLcode res = CURLE_OK; - struct progress prog; if (!isatty(STDERR_FILENO)) noprogress = 1L; @@ -80,7 +68,6 @@ struct MemoryStruct* downloadToRam(const char* URL, long noprogress) curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, xferinfo); - curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, &prog); curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, noprogress); res = curl_easy_perform(curl_handle); |