diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-06-28 20:42:51 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-06-28 20:42:51 +0800 |
commit | 3dd44e9bd785d14bd867fa9ca9f17365238578c7 (patch) | |
tree | 1225c82cb7e742cfbeb4e793fe7e8762f62c1848 | |
parent | 8c54bda950083a8b3f7420b03c7f4d1d8ceeaaa9 (diff) |
Order init function
-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++) |