diff options
-rw-r--r-- | client.c | 5 | ||||
-rw-r--r-- | icclient/ord.h | 1 | ||||
-rw-r--r-- | ord.c | 8 |
3 files changed, 10 insertions, 4 deletions
@@ -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 @@ -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++) |