summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--icclient/ord.h13
-rw-r--r--ord.c10
3 files changed, 16 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index 2240f39..5a4585a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,6 +10,7 @@ libicclient_a_SOURCES = \
request.c \
login.h \
login.c \
+ ord.c \
member.c \
admin.c \
client.c
diff --git a/icclient/ord.h b/icclient/ord.h
index 4491ba4..0cd0e75 100644
--- a/icclient/ord.h
+++ b/icclient/ord.h
@@ -1,25 +1,22 @@
#ifndef ICCLIENT_ORD_H
#define ICCLIENT_ORD_H
-#include "product.h"
-
-struct icclient_item {
+struct icclient_ord_item {
struct icclient_product *product;
unsigned int quantity;
};
-struct icclient_order {
- double subtotal, shipping, totalcost;
+struct icclient_ord_order {
+ double subtotal, shipping, total_cost;
size_t nitems;
- struct icclient_item *items[];
+ struct icclient_ord_item *items[];
};
#ifdef __cplusplus
extern "C" {
#endif
- void icclient_remove(const unsigned int *indices);
- void icclient_checkout(struct ic_order *order);
+ void icclient_ord_free(struct icclient_ord_order *order);
#ifdef __cplusplus
}
diff --git a/ord.c b/ord.c
new file mode 100644
index 0000000..4122b57
--- /dev/null
+++ b/ord.c
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include <stdbool.h>
+#include "icclient/client.h"
+#include "icclient/ord.h"
+
+void icclient_ord_free(struct icclient_ord_order *order)
+{
+ for (size_t i = 0; i < order->nitems; i++)
+ icclient_freeproduct(order->items[i]->product);
+}