]> err.no Git - mapper/commitdiff
Add path_new and path_free. No need to set fields two 0 in macro.
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 13 Mar 2008 14:36:03 +0000 (16:36 +0200)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 13 Mar 2008 14:36:03 +0000 (16:36 +0200)
src/path.c
src/path.h

index 9dc7d0141551020ce9ea7e1e0286b3da68c6301f..df0ce1c9f7fe490b4e74227225ddeb9408007642 100644 (file)
 #include "settings.h"
 #include "latlon.h"
 
+Path *
+path_new(void)
+{
+Path *p;
+
+p=g_slice_new0(Path);
+MACRO_PATH_INIT(*p);
+return p;
+}
+
+void
+path_free(Path *p)
+{
+MACRO_PATH_FREE(*p);
+g_slice_free(Path, p);
+}
+
 void 
 path_resize(Path *path, guint size)
 {
index ac9da8009e20542fe8840a43a17790893db2735a..f5cc4e0d38417433feac574c15b5a61010d55e50 100644 (file)
@@ -11,7 +11,6 @@
        (path).whead = g_new0(WayPoint, ARRAY_CHUNK_SIZE); \
        (path).wtail = (path).whead - 1; \
        (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
-       (path).length=(path).maxspeed=(path).tspeed=(path).avgspeed=(path).points=0; \
 }
 
 #define MACRO_PATH_FREE(path) if((path).head) { \
@@ -99,6 +98,9 @@ Point _point_null;
 Position _home;
 Position _dest;
 
+Path *path_new(void);
+void path_free(Path *p);
+
 void path_resize(Path *path, guint size);
 void path_wresize(Path *path, guint wsize);