diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-17 22:12:36 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-17 22:12:36 +0800 |
commit | 4aef78b56e9ee5f51ce80171288242c8881842f0 (patch) | |
tree | 9ab4c915bc5bdadd05adfe6693f497bf23c7b299 /request.h | |
parent | 71e1c7fc557e68743c4a8028b2d6675639be16cc (diff) |
Rename fetch to response
Diffstat (limited to 'request.h')
-rw-r--r-- | request.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -23,7 +23,7 @@ extern emscripten_fetch_attr_t attr; #else extern CURL *curl; extern char *sampleurl; -size_t append(char *, size_t, size_t, icclient_fetch_t *); +size_t append(char *, size_t, size_t, icclient_response *); #endif static inline void init(const char *certificate) @@ -44,7 +44,7 @@ static inline void init(const char *certificate) #endif } -static inline void request(void (*handler)(icclient_fetch_t *), void (*callback)(void *), struct body *body, char *fmt, ...) +static inline void request(void (*handler)(icclient_response *), void (*callback)(void *), struct body *body, char *fmt, ...) { va_list ap; char *p, *sval; @@ -138,7 +138,7 @@ static inline void request(void (*handler)(icclient_fetch_t *), void (*callback) #else curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, append); - icclient_fetch_t fetch = { .numBytes = 0 }; + icclient_response response = { .numBytes = 0 }; struct curl_httppost *post, *last = NULL; if (body) { for (size_t i = 0; i < body->num_pairs; i++) { @@ -155,15 +155,15 @@ static inline void request(void (*handler)(icclient_fetch_t *), void (*callback) struct icclient_post_callback *post_callback = malloc(sizeof(struct icclient_post_callback)); post_callback->post = post; post_callback->callback = callback; - fetch.userData = post_callback; + response.userData = post_callback; } else { curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); - fetch.userData = callback; + response.userData = callback; } - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fetch); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); CURLcode res = curl_easy_perform(curl); if (res == CURLE_OK && handler) - handler(&fetch); + handler(&response); #ifdef DEBUG else { const char *error = curl_easy_strerror(res); |