summaryrefslogtreecommitdiff
path: root/handler.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-01-11 11:27:08 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-01-11 11:27:08 +0800
commit64ea94aad7253df25798263d6bd1c8c49ceb393d (patch)
treefe52659a09601112e10a2f0998f55419b391f9b6 /handler.c
parentebaf4cf23f8ccdbf020309eacc2f9d9129c05f83 (diff)
Conform to new APIHEADmaster
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/handler.c b/handler.c
index 37469ba..782a3e2 100644
--- a/handler.c
+++ b/handler.c
@@ -2,12 +2,12 @@
#include <stdbool.h>
#include <tidy.h>
#include <tidybuffio.h>
-#include <icclient.h>
+#include <interchange.h>
#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);