From 4aef78b56e9ee5f51ce80171288242c8881842f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 17 Jun 2021 22:12:36 +0800 Subject: Rename fetch to response --- request.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'request.h') diff --git a/request.h b/request.h index 64d6974..ec6720a 100644 --- a/request.h +++ b/request.h @@ -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); -- cgit v1.2.3