From 200909484e3ccb263f18a166c2c6c1de113a6a3b 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: Wed, 14 Sep 2022 20:29:03 +0800 Subject: Reorder functions --- shopify.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/shopify.c b/shopify.c index fd1c396..6fb4037 100644 --- a/shopify.c +++ b/shopify.c @@ -53,6 +53,14 @@ extern inline void request_token(const char *, const char *, const char *, extern inline void request_cleanup(); extern inline void token_parse(char *, struct session *); +void shopify_init() +{ + crypt_init(); + request_init(); + sessions = malloc(sizeof(struct session)); + sessions[0].shop = NULL; +} + static enum MHD_Result getparam(void *cls, enum MHD_ValueKind kind, const char *key, const char *val) { @@ -72,12 +80,13 @@ static enum MHD_Result getparam(void *cls, enum MHD_ValueKind kind, return MHD_YES; } -void shopify_init() +static inline void clear(struct shopify_param params[]) { - crypt_init(); - request_init(); - sessions = malloc(sizeof(struct session)); - sessions[0].shop = NULL; + int i = 0; + while (params[i].key) { + free(params[i].val); + free(params[i++].key); + } } static int paramcmp(const void *param1, const void *param2) @@ -92,15 +101,6 @@ static int sessioncmp(const void *session1, const void *session2) ((struct session *)session2)->shop); } -static inline void clear(struct shopify_param params[]) -{ - int i = 0; - while (params[i].key) { - free(params[i].val); - free(params[i++].key); - } -} - bool shopify_valid(struct MHD_Connection *conn, const char *url, const char *redir_url, const char *secret_key, struct shopify_param *params[]) -- cgit v1.2.3