From 64ea94aad7253df25798263d6bd1c8c49ceb393d 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, 11 Jan 2023 11:27:08 +0800 Subject: Conform to new API --- handler.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'handler.c') diff --git a/handler.c b/handler.c index 37469ba..782a3e2 100644 --- a/handler.c +++ b/handler.c @@ -2,12 +2,12 @@ #include #include #include -#include +#include #define SUBDIR "/items" static void recurse_catalog(TidyDoc doc, TidyNode tnod, const char *image_dir, - struct icclient_catalog **catalog) + struct interchange_catalog **catalog) { for (TidyNode child = tidyGetChild(tnod); child; child = tidyGetNext(child)) { ctmbstr name = tidyNodeGetName(child); @@ -29,8 +29,8 @@ static void recurse_catalog(TidyDoc doc, TidyNode tnod, const char *image_dir, } if (bail) continue; - struct icclient_product *product = malloc(sizeof(struct icclient_product)); - memset(product, '\0', sizeof(struct icclient_product)); + struct interchange_product *product = malloc(sizeof(struct interchange_product)); + memset(product, '\0', sizeof(struct interchange_product)); for (TidyAttr attr = tidyAttrFirst(child); attr; attr = tidyAttrNext(attr)) { name = tidyAttrName(attr); ctmbstr value = tidyAttrValue(attr); @@ -47,19 +47,19 @@ static void recurse_catalog(TidyDoc doc, TidyNode tnod, const char *image_dir, } } (*catalog)->length++; - *catalog = realloc(*catalog, sizeof(struct icclient_catalog) - + sizeof(struct icclient_product *[(*catalog)->length])); + *catalog = realloc(*catalog, sizeof(struct interchange_catalog) + + sizeof(struct interchange_product *[(*catalog)->length])); (*catalog)->products[(*catalog)->length - 1] = product; } } -struct icclient_catalog *catalog(const char *response, const char *image_dir) +struct interchange_catalog *catalog(const char *response, const char *image_dir) { TidyDoc tdoc = tidyCreate(); TidyBuffer output = {0}; tidyParseString(tdoc, response); tidySaveBuffer(tdoc, &output); - struct icclient_catalog *catalog = malloc(sizeof(struct icclient_catalog)); + struct interchange_catalog *catalog = malloc(sizeof(struct interchange_catalog)); catalog->length = 0; recurse_catalog(tdoc, tidyGetRoot(tdoc), image_dir, &catalog); tidyBufFree(&output); -- cgit v1.2.3