diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | catalog.c | 11 | ||||
-rw-r--r-- | client.c | 8 | ||||
-rw-r--r-- | icclient/catalog.h | 10 | ||||
-rw-r--r-- | icclient/client.h | 1 |
5 files changed, 22 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index 0ac0146..5f94fbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ libicclient_la_SOURCES = \ request.h \ request.c \ product.c \ + catalog.c \ ord.c \ login.h \ login.c \ diff --git a/catalog.c b/catalog.c new file mode 100644 index 0000000..27e2385 --- /dev/null +++ b/catalog.c @@ -0,0 +1,11 @@ +#include <stdlib.h> +#include "icclient/product.h" +#include "icclient/catalog.h" + +void icclient_catalog_free(struct icclient_catalog *catalog) +{ + for (size_t i = 0; i < catalog->length; i++) + icclient_product_free(catalog->products[i]); + free(catalog); + catalog = NULL; +} @@ -167,14 +167,6 @@ void icclient_page(const char *path, size_t (*handler)(void *, size_t, size_t request(handler, (void *)dataptr, NULL, "%s", path); } -void icclient_freecatalog(icclient_catalog *catalog) -{ - for (size_t i = 0; i < catalog->length; i++) - icclient_product_free(catalog->products[i]); - free(catalog); - catalog = NULL; -} - void icclient_cleanup() { if (curl) { diff --git a/icclient/catalog.h b/icclient/catalog.h index b38434b..ee65c1e 100644 --- a/icclient/catalog.h +++ b/icclient/catalog.h @@ -6,4 +6,14 @@ struct icclient_catalog { struct icclient_product *products[]; }; +#ifdef __cplusplus +extern "C" { +#endif + + void icclient_catalog_free(struct icclient_catalog *catalog); + +#ifdef __cplusplus +} +#endif + #endif // ICCLIENT_CATALOG_H diff --git a/icclient/client.h b/icclient/client.h index 4a9ac6a..02804bb 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -73,7 +73,6 @@ extern "C" { size_t (*handler)(void *contents, size_t size, size_t nmemb, void *userdata), void **dataptr); - void icclient_freecatalog(struct icclient_catalog *catalog); void icclient_cleanup(); #ifdef __cplusplus |