changeset 1508:006b79fc386b

Add functions for freeing MapLoc structures.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 07 Feb 2015 06:35:01 +0200
parents 4a62701d805e
children 7eeae6b4bce0
files liblocfile.c liblocfile.h
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liblocfile.c	Sat Feb 07 06:24:09 2015 +0200
+++ b/liblocfile.c	Sat Feb 07 06:35:01 2015 +0200
@@ -142,7 +142,6 @@
 void locFreeMarkerData(LocMarker *marker)
 {
     int i;
-
     for (i = 0; i < LOC_MAX_NAMES; i++)
     {
         th_free(marker->names[i].name);
@@ -156,6 +155,22 @@
 }
 
 
+void locFreeMapLocations(MapLocations *loc)
+{
+    if (loc->locations != NULL)
+    {
+        int i;
+        for (i = 0; i < loc->n; i++)
+        if (loc->locations[i] != NULL)
+        {
+            locFreeMarkerData(loc->locations[i]);
+            th_free(loc->locations[i]);
+        }
+        th_free(loc->locations);
+    }
+}
+
+
 enum
 {
     PM_IDLE = 0,
--- a/liblocfile.h	Sat Feb 07 06:24:09 2015 +0200
+++ b/liblocfile.h	Sat Feb 07 06:35:01 2015 +0200
@@ -132,6 +132,8 @@
          const char *uri, const char *freeform, LocFileInfo *file);
 
 BOOL   locParseLocStream(LocFileInfo *f, MapLocations *l, int offX, int offY);
+void   locFreeMarkerData(LocMarker *marker);
+void   locFreeMapLocations(MapLocations *loc);
 
 int    locFindByCoords(MapLocations *l, int x, int y, BOOL locTrue);