From 208a92b58f863efa2c7f6301d44d3a2de3fa7745 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:16:08 +0800 Subject: Merge handler.c to pikul.c --- Makefile.am | 2 +- handler.c | 13 ------------- pikul.c | 14 +++++++++++++- 3 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 handler.c diff --git a/Makefile.am b/Makefile.am index f5a691e..ff1a123 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ lib_LTLIBRARIES = libpikul.la -libpikul_la_SOURCES = pikul.c handler.c \ +libpikul_la_SOURCES = pikul.c \ anteraja.c libpikul_la_CPPFLAGS = $(DEPS_CFLAGS) libpikul_la_LDFLAGS = $(DEPS_LIBS) diff --git a/handler.c b/handler.c deleted file mode 100644 index 581001e..0000000 --- a/handler.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "handler.h" - -extern inline void handle(const char *, size_t, struct container *); - -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; -} diff --git a/pikul.c b/pikul.c index f078449..08c37ec 100644 --- a/pikul.c +++ b/pikul.c @@ -1,12 +1,14 @@ #include -#include #include "shipping.h" +#include "handler.h" CURL *curl; json_tokener *tokener; static struct shipping shipping; extern inline void headers(struct shipping *shipping, const char *fields[], char *provisions[]); +extern inline void handle(const char *, size_t, struct container *); + extern void anteraja_init(char *[], struct shipping *); extern void anteraja_services_request(const char *, const char *, double, struct shipping *, char **, char **); @@ -101,3 +103,13 @@ 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