summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client.c5
-rw-r--r--icclient/ord.h1
-rw-r--r--ord.c8
3 files changed, 10 insertions, 4 deletions
diff --git a/client.c b/client.c
index 4bec7bb..61b4f4c 100644
--- a/client.c
+++ b/client.c
@@ -106,10 +106,7 @@ void icclient_order(icclient_ord_order **orderptr, const char *sku
} else {
*orderptr = malloc(sizeof(icclient_ord_order));
order = *orderptr;
- order->subtotal = .0;
- order->shipping = .0;
- order->subtotal = .0;
- order->nitems = 0;
+ icclient_ord_init(order);
}
if (item)
diff --git a/icclient/ord.h b/icclient/ord.h
index 5632ffe..638880a 100644
--- a/icclient/ord.h
+++ b/icclient/ord.h
@@ -18,6 +18,7 @@ struct icclient_ord_order {
extern "C" {
#endif
+ void icclient_ord_init(struct icclient_ord_order *order);
void icclient_ord_free(struct icclient_ord_order *order);
#ifdef __cplusplus
diff --git a/ord.c b/ord.c
index c1c2d4c..f59a4b9 100644
--- a/ord.c
+++ b/ord.c
@@ -3,6 +3,14 @@
#include "icclient/product.h"
#include "icclient/ord.h"
+void icclient_ord_init(struct icclient_ord_order *order)
+{
+ order->subtotal = .0;
+ order->shipping = .0;
+ order->subtotal = .0;
+ order->nitems = 0;
+}
+
void icclient_ord_free(struct icclient_ord_order *order)
{
for (size_t i = 0; i < order->nitems; i++)