summaryrefslogtreecommitdiff
path: root/pikul.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-28 00:21:56 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-28 00:21:56 +0800
commit28f67fdbb55bed728f5ab9feb348c8589e85583e (patch)
treec908ccd4e9f59e4b144c3be1d0c0ab7f7c729099 /pikul.c
parent314f1aa68ebcab0a9c5f8a1d1247098fb8eb9d6e (diff)
Reorganise a bit
Diffstat (limited to 'pikul.c')
-rw-r--r--pikul.c21
1 files 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 <string.h>
#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;
-}