summaryrefslogtreecommitdiff
path: root/pikul.c
diff options
context:
space:
mode:
Diffstat (limited to 'pikul.c')
-rw-r--r--pikul.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/pikul.c b/pikul.c
index b40ee17..93bc664 100644
--- a/pikul.c
+++ b/pikul.c
@@ -225,6 +225,26 @@ struct pikul_place **pikul_destinations(enum pikul_company company)
return (struct pikul_place **)shipping->data;
}
+static inline void free_place(struct pikul_place *place)
+{
+ if (place->province)
+ free(place->province);
+ if (place->city)
+ free(place->city);
+ if (place->district)
+ free(place->district);
+ free(place->code);
+ free(place);
+}
+
+void pikul_free_places(struct pikul_place **places)
+{
+ size_t i = 0;
+ while (places[i])
+ free_place(places[i++]);
+ free(places);
+}
+
struct pikul_service **pikul_services(enum pikul_company company,
const char *origin, const char *destination, double weight)
{