From 737bd34f39e9a3d14d170633e07c555d9e26d026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Thu, 26 Sep 2019 11:19:10 +0800 Subject: Build product code again --- product.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'product.c') diff --git a/product.c b/product.c index d5d9bbe..bc7a7ea 100644 --- a/product.c +++ b/product.c @@ -1,21 +1,25 @@ #include -#include "icclient/request.h" +#include "request.h" #include "icclient/product.h" void icclient_product_all(struct ic_catalog **catalogptr , size_t (*callback)(void *, size_t, size_t, void *)) { - request("All-Products", callback, (void *)catalogptr, NULL); + request(NULL, NULL, NULL, "%s", "All-Products"); } void rtclient_product_freecatalog(struct ic_catalog *catalog) { - for (unsigned short i = 0; i < catalog->length; i++) { + for (size_t i = 0; i < catalog->length; i++) { struct ic_product *product = catalog->products[i]; - free(product->image); - free(product->comment); - free(product->description); - free(product->sku); + if (product->image) + free(product->image); + if (product->comment) + free(product->comment); + if (product->description) + free(product->description); + if (product->sku) + free(product->sku); free(product); } free(catalog); -- cgit v1.2.3