diff options
| author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-06-20 11:24:12 +0800 |
|---|---|---|
| committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-06-20 11:24:12 +0800 |
| commit | a3b91bf175b9d51fdd3674112e60a773f13c8ea9 (patch) | |
| tree | c297742f6f068afed7fe7e901192cd21d2f7b9ee /client.c | |
| parent | 0d45381125b73feea759213b8341deb4e08d600c (diff) | |
Move product freeing implementation to product's own implementation
Diffstat (limited to 'client.c')
| -rw-r--r-- | client.c | 23 |
1 files changed, 2 insertions, 21 deletions
@@ -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; } |