From 89b7bef4c433bb42588eeec6e6f0d3d1c2a19b78 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, 5 Oct 2019 18:06:14 +0800 Subject: Separate the product structure definition so the catalog structure doesn't have to be included when not needed. product.c has too few implementations, so it's merged to client.c --- icclient/catalog.h | 9 +++++++++ icclient/client.h | 3 +++ icclient/product.h | 20 ++++---------------- 3 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 icclient/catalog.h (limited to 'icclient') diff --git a/icclient/catalog.h b/icclient/catalog.h new file mode 100644 index 0000000..b38434b --- /dev/null +++ b/icclient/catalog.h @@ -0,0 +1,9 @@ +#ifndef ICCLIENT_CATALOG_H +#define ICCLIENT_CATALOG_H + +struct icclient_catalog { + size_t length; + struct icclient_product *products[]; +}; + +#endif // ICCLIENT_CATALOG_H diff --git a/icclient/client.h b/icclient/client.h index 053eee5..e49af36 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -1,6 +1,7 @@ #ifndef ICCLIENT_CLIENT_H #define ICCLIENT_CLIENT_H +struct icclient_product; struct icclient_catalog; #ifdef __cplusplus @@ -22,6 +23,8 @@ extern "C" { , size_t (*handler)(void *contents, size_t size , size_t nmemb, void *userdata) , void **dataptr); + void icclient_freeproduct(struct icclient_product *product); + void icclient_freecatalog(struct icclient_catalog *catalog); void icclient_cleanup(); #ifdef __cplusplus diff --git a/icclient/product.h b/icclient/product.h index 0b0e509..4e879e0 100644 --- a/icclient/product.h +++ b/icclient/product.h @@ -2,23 +2,11 @@ #define ICCLIENT_PRODUCT_H struct icclient_product { - char *sku, *description, *comment, *image; + char *sku; + char *description; + char *comment; + char *image; double price; }; -struct icclient_catalog { - size_t length; - struct icclient_product *products[]; -}; - -#ifdef __cplusplus -extern "C" { -#endif - - void icclient_catalog_free(struct icclient_catalog *catalog); - -#ifdef __cplusplus -} -#endif - #endif // ICCLIENT_PRODUCT_H -- cgit v1.2.3