From 578cf4ca96749ba0875d1f15333dea5b43e36011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 4 Sep 2019 17:02:00 +0800 Subject: Renamed the handle variable to just curl --- rtclient.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/rtclient.c b/rtclient.c index a8430b5..30f2942 100644 --- a/rtclient.c +++ b/rtclient.c @@ -11,24 +11,24 @@ #include #include "rtclient.h" -static CURL *handle = NULL; +static CURL *curl = NULL; static char *server_url = NULL; bool rtclient_init(const char *url) { curl_global_init(CURL_GLOBAL_SSL); - handle = curl_easy_init(); - if (handle) { - curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(handle, CURLOPT_COOKIEFILE, ""); + curl = curl_easy_init(); + if (curl) { + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); #ifdef DEBUG - curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); #endif // DEBUG server_url = malloc(strlen(url) + 1); strcpy(server_url, url); } - return (bool)handle; + return (bool)curl; } void rtclient_login(const char *name, const char *password) @@ -44,12 +44,12 @@ void rtclient_login(const char *name, const char *password) CURLFORM_END); last = NULL; - curl_easy_setopt(handle, CURLOPT_URL, server_url); - curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); + curl_easy_setopt(curl, CURLOPT_URL, server_url); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, post); #ifdef DEBUG CURLcode res = #endif // DEBUG - curl_easy_perform(handle); + curl_easy_perform(curl); #ifdef DEBUG if (res != CURLE_OK) { const char *error = curl_easy_strerror(res); @@ -67,16 +67,16 @@ void rtclient_user(const char *name) static const char *user_path = "/REST/1.0/user/"; char user_url[strlen(server_url) + strlen(user_path) + strlen(name) + 1]; sprintf(user_url, "%s%s%s", server_url, user_path, name); - curl_easy_setopt(handle, CURLOPT_URL, user_url); - curl_easy_setopt(handle, CURLOPT_HTTPGET, 1L); - curl_easy_perform(handle); + curl_easy_setopt(curl, CURLOPT_URL, user_url); + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); + curl_easy_perform(curl); } void rtclient_cleanup() { - if (handle) { + if (curl) { free(server_url); - curl_easy_cleanup(handle); + curl_easy_cleanup(curl); } curl_global_cleanup(); } -- cgit v1.2.3