From 2419d61c5171479586ba606834dcbfaa138c9bb3 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: Sat, 17 Jul 2021 20:47:59 +0800 Subject: Rename waybill to tracking_number --- anteraja.c | 4 ++-- handler.h | 6 +++--- pikul.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/anteraja.c b/anteraja.c index 14e32a0..0e5f2e7 100644 --- a/anteraja.c +++ b/anteraja.c @@ -146,14 +146,14 @@ void anteraja_order(const char *order_number, const char *service, const char *s curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); } -size_t anteraja_order_handle(const char *contents, size_t size, size_t nmemb, char **waybill) +size_t anteraja_order_handle(const char *contents, size_t size, size_t nmemb, char **tracking_number) { size_t realsize = size * nmemb; handle(ORDER, contents, realsize, status_trail, (const char *[]){ "content", "waybill_no", NULL - }, NULL, waybill); + }, NULL, tracking_number); return realsize; } diff --git a/handler.h b/handler.h index e940d91..a2c031b 100644 --- a/handler.h +++ b/handler.h @@ -75,9 +75,9 @@ inline void handle(enum type type, const char *contents, size_t num_bytes, const ; struct json_object *string = NULL; recurse(response, trail, &string); - char **waybill = (char **)data; - *waybill = malloc(json_object_get_string_len(string) + 1); - strcpy(*waybill, json_object_get_string(string)); + char **tracking_number = (char **)data; + *tracking_number = malloc(json_object_get_string_len(string) + 1); + strcpy(*tracking_number, json_object_get_string(string)); break; default: break; diff --git a/pikul.c b/pikul.c index cb74feb..b3e6352 100644 --- a/pikul.c +++ b/pikul.c @@ -4,7 +4,7 @@ CURL *curl; json_tokener *tokener; struct shipping shipping; -static char *waybill = NULL; +static char *tracking_number = NULL; extern inline void headers(const char *[], char *[]); extern inline void handle(enum type, const char *, size_t, const char *[], const char *[], const char *[], @@ -118,7 +118,7 @@ char *pikul_order(const char *order_number, const char *service, const char *sen const char *destination, const char *receiver_address, const char *receiver_postal, int nitems, char **items[], _Bool insurance, double subtotal) { - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &waybill); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &tracking_number); char *url; char *post = NULL; size_t (*handler)(const char *, size_t, size_t, char **); @@ -139,7 +139,7 @@ char *pikul_order(const char *order_number, const char *service, const char *sen if (post) free(post); free(url); - return waybill; + return tracking_number; } void pikul_cleanup() @@ -151,8 +151,8 @@ void pikul_cleanup() default: break; } - if (waybill) - free(waybill); + if (tracking_number) + free(tracking_number); free(shipping.base); json_tokener_free(tokener); curl_slist_free_all(shipping.headers); -- cgit v1.2.3