From 28f67fdbb55bed728f5ab9feb348c8589e85583e 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, 28 Jun 2021 00:21:56 +0800 Subject: Reorganise a bit --- pikul.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pikul.c b/pikul.c index 08c37ec..c7cdb56 100644 --- a/pikul.c +++ b/pikul.c @@ -1,4 +1,3 @@ -#include #include "shipping.h" #include "handler.h" @@ -33,6 +32,16 @@ void pikul_init(enum pikul_company company, char *provisions[]) tokener = json_tokener_new(); } +void recurse(struct json_object *outer, const char *keys[], struct json_object **services) +{ + struct json_object *inner = NULL; + json_object_object_get_ex(outer, *keys, &inner); + if (*++keys) + recurse(inner, keys, services); + else + *services = inner; +} + struct pikul_services *pikul_services(const char *origin, const char *destination, double weight) { struct pikul_services *services = NULL; @@ -103,13 +112,3 @@ void pikul_cleanup() curl_easy_cleanup(curl); curl_global_cleanup(); } - -void recurse(struct json_object *outer, const char *keys[], struct json_object **services) -{ - struct json_object *inner = NULL; - json_object_object_get_ex(outer, *keys, &inner); - if (*++keys) - recurse(inner, keys, services); - else - *services = inner; -} -- cgit v1.2.3