From a3b91bf175b9d51fdd3674112e60a773f13c8ea9 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: Sat, 20 Jun 2020 11:24:12 +0800 Subject: Move product freeing implementation to product's own implementation --- client.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 9af1be5..604e849 100644 --- a/client.c +++ b/client.c @@ -89,7 +89,7 @@ void icclient_order(icclient_ord_order **orderptr, const char *sku icclient_product *product = *(icclient_product **)bsearch(&key_product , products, catalog->length, sizeof(icclient_product *) , prodcmp); - icclient_freeproduct(key_product); + icclient_product_free(key_product); icclient_ord_order *order = *orderptr; icclient_ord_item *item = NULL; @@ -167,29 +167,10 @@ void icclient_page(const char *path, size_t (*handler)(void *, size_t, size_t request(handler, (void *)dataptr, NULL, "%s", path); } -void icclient_freeproduct(icclient_product *product) -{ - if (product->author) - free(product->author); - if (product->prodgroup) - free(product->prodgroup); - if (product->image) - free(product->image); - if (product->thumb) - free(product->thumb); - if (product->comment) - free(product->comment); - if (product->description) - free(product->description); - free(product->sku); - free(product); - product = NULL; -} - void icclient_freecatalog(icclient_catalog *catalog) { for (size_t i = 0; i < catalog->length; i++) - icclient_freeproduct(catalog->products[i]); + icclient_product_free(catalog->products[i]); free(catalog); catalog = NULL; } -- cgit v1.2.3