summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-17 20:47:59 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-17 20:47:59 +0800
commit2419d61c5171479586ba606834dcbfaa138c9bb3 (patch)
tree074724342b5dc99af63b461a8ac60a9989d890d3
parent7b90ae5879f80ddb9f0a11aaa0fb63d16844fa59 (diff)
Rename waybill to tracking_number
-rw-r--r--anteraja.c4
-rw-r--r--handler.h6
-rw-r--r--pikul.c10
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);