#endif
#include <glib.h>
#include "config.h"
-#include "debug.h"
+#include "point.h"
+#include "graphics.h"
#include "profile.h"
#include "coord.h"
#include "projection.h"
#include "mapset.h"
#include "route.h"
#include "track.h"
-#include "point.h"
-#include "graphics.h"
#include "transform.h"
#include "plugin.h"
#include "fib.h"
#include "vehicle.h"
#include "vehicleprofile.h"
#include "roadprofile.h"
+#include "debug.h"
struct map_priv {
hashval=HASHCOORD(f);
if (debug_route)
printf("p (0x%x,0x%x)\n", f->x, f->y);
- p=g_new0(struct route_graph_point,1);
+ p=g_slice_new0(struct route_graph_point);
p->hash_next=this->hash[hashval];
this->hash[hashval]=p;
p->value=INT_MAX;
curr=this->hash[i];
while (curr) {
next=curr->hash_next;
- g_free(curr);
+ g_slice_free(struct route_graph_point, curr);
curr=next;
}
this->hash[i]=NULL;
int size;
size = sizeof(struct route_graph_segment)-sizeof(struct route_segment_data)+route_segment_data_size(data->flags);
- s = g_malloc0(size);
+ s = g_slice_alloc0(size);
if (!s) {
printf("%s:Out of memory\n", __FUNCTION__);
return;
route_graph_free_segments(struct route_graph *this)
{
struct route_graph_segment *curr,*next;
+ int size;
curr=this->route_segments;
while (curr) {
next=curr->next;
- g_free(curr);
+ size = sizeof(struct route_graph_segment)-sizeof(struct route_segment_data)+route_segment_data_size(curr->data.flags);
+ g_slice_free1(size, curr);
curr=next;
}
this->route_segments=NULL;
rg->mr=NULL;
rg->h=NULL;
rg->sel=NULL;
- route_graph_process_restrictions(rg);
- if (! cancel)
+ if (! cancel) {
+ route_graph_process_restrictions(rg);
callback_call_0(rg->done_cb);
+ }
rg->busy=0;
}
void
route_info_free(struct route_info *inf)
{
+ if (!inf)
+ return;
if (inf->street)
street_data_free(inf->street);
g_free(inf);
plugin_register_map_type("route_graph", route_graph_map_new);
}
+void
+route_destroy(struct route *this_)
+{
+ route_path_destroy(this_->path2);
+ route_graph_destroy(this_->graph);
+ route_info_free(this_->dst);
+ route_info_free(this_->pos);
+ map_destroy(this_->map);
+ map_destroy(this_->graph_map);
+ g_free(this_);
+}