diff options
Diffstat (limited to 'handler.c')
-rw-r--r-- | handler.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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); |