From 531aaf6e9d01a4ae3257579996681bbe8246630f 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: Mon, 19 Jul 2021 14:10:55 +0800 Subject: Implementations don't need the CURL* object that much --- pikul.c | 4 ++++ sicepat.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pikul.c b/pikul.c index c8ac2b5..7d0e739 100644 --- a/pikul.c +++ b/pikul.c @@ -75,6 +75,8 @@ struct pikul_services *pikul_services(const char *origin, const char *destinatio curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, handler); if (post) curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post); + else + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_perform(curl); if (post) free(post); @@ -148,6 +150,8 @@ char *pikul_order(const char *order_number, const char *service, const char *sen curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, handler); if (post) curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post); + else + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_perform(curl); if (post) free(post); diff --git a/sicepat.c b/sicepat.c index 955f043..1fedbfd 100644 --- a/sicepat.c +++ b/sicepat.c @@ -2,8 +2,6 @@ #define BASE "http://api.sicepat.com/customer/" -extern CURL *curl; - static const char *status_trail[] = { "sicepat", "status", @@ -22,9 +20,8 @@ void sicepat_services(const char *origin, const char *destination, double weight { *url = malloc(strlen(shipping.base) + strlen("tariff?origin=") + strlen(origin) + strlen("&destination=") + strlen(destination) + strlen("&weight=") + 9); - sprintf(*url, "%stariff?origin=%s&destination=%s&weight=%f", shipping.base, - origin, destination, weight); - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); + sprintf(*url, "%stariff?origin=%s&destination=%s&weight=%f", shipping.base, origin, destination, + weight); } size_t sicepat_services_handle(const char *contents, size_t size, size_t nmemb, -- cgit v1.2.3