Commit ed210cdc authored by Jiří Techet's avatar Jiří Techet

Use g_slice_new() instead of g_new() where possible

Signed-off-by: 's avatarJiří Techet <techet@gmail.com>
parent e884e784
......@@ -535,7 +535,7 @@ tile_loaded_cb (ClutterTexture *texture,
if (tile)
g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &user_data->tile);
g_free (user_data);
g_slice_free (TileLoadedCallbackData, user_data);
if (!tile)
{
......@@ -645,7 +645,7 @@ fill_tile (ChamplainMapSource *map_source,
TileLoadedCallbackData *callback_data;
ClutterTexture *texture;
callback_data = g_new (TileLoadedCallbackData, 1);
callback_data = g_slice_new (TileLoadedCallbackData);
callback_data->tile = tile;
callback_data->map_source = map_source;
callback_data->filename = get_filename (file_cache, tile);
......
......@@ -249,7 +249,7 @@ delete_queue_member (QueueMember *member, gpointer user_data)
{
g_free (member->key);
g_free (member->data);
g_free (member);
g_slice_free (QueueMember, member);
}
}
......@@ -354,7 +354,7 @@ store_tile (ChamplainTileCache *tile_cache,
delete_queue_member (member, NULL);
}
member = g_new0 (QueueMember, 1);
member = g_slice_new (QueueMember);
member->key = key.key;
member->data = g_memdup (contents, size);
member->size = size;
......
......@@ -308,7 +308,7 @@ tile_loaded_cb (gpointer worker_data)
if (tile)
g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
g_free (data);
g_slice_free (WorkerThreadData, data);
if (!tile)
{
......@@ -415,7 +415,7 @@ render (ChamplainRenderer *renderer,
champlain_tile_get_y (tile),
champlain_tile_get_zoom_level (tile));
data = g_new (WorkerThreadData, 1);
data = g_slice_new (WorkerThreadData);
data->x = champlain_tile_get_x (tile);
data->y = champlain_tile_get_y (tile);
data->z = champlain_tile_get_zoom_level (tile);
......@@ -431,7 +431,7 @@ render (ChamplainRenderer *renderer,
{
g_error ("Thread pool error: %s", error->message);
g_error_free (error);
g_free (data);
g_slice_free (WorkerThreadData, data);
g_object_unref (renderer);
g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
}
......
......@@ -544,7 +544,7 @@ destroy_cb_data (TileDestroyedCbData *data,
if (data->map_source)
g_object_remove_weak_pointer (G_OBJECT (data->map_source), (gpointer *) &data->map_source);
g_free (data);
g_slice_free (TileDestroyedCbData, data);
}
......@@ -576,7 +576,7 @@ tile_rendered_cb (ChamplainTile *tile, ChamplainRenderCallbackData *data, TileRe
}
g_object_unref (map_source);
g_free (user_data);
g_slice_free (TileRenderedCallbackData, user_data);
g_signal_handlers_disconnect_by_func (tile, tile_rendered_cb, user_data);
}
......@@ -600,7 +600,7 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
if (tile)
g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &callback_data->tile);
g_free (user_data);
g_slice_free (TileLoadedCallbackData, callback_data);
DEBUG ("Got reply %d", msg->status_code);
......@@ -637,7 +637,7 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
etag = soup_message_headers_get (msg->response_headers, "ETag");
DEBUG ("Received ETag %s", etag);
data = g_new (TileRenderedCallbackData, 1);
data = g_slice_new (TileRenderedCallbackData);
data->map_source = map_source;
data->etag = g_strdup (etag);
......@@ -739,7 +739,7 @@ fill_tile (ChamplainMapSource *map_source,
g_free (date);
}
TileDestroyedCbData *tile_destroyed_cb_data = g_new (TileDestroyedCbData, 1);
TileDestroyedCbData *tile_destroyed_cb_data = g_slice_new (TileDestroyedCbData);
tile_destroyed_cb_data->map_source = map_source;
tile_destroyed_cb_data->msg = msg;
......@@ -749,7 +749,7 @@ fill_tile (ChamplainMapSource *map_source,
g_signal_connect_data (tile, "destroy", G_CALLBACK (tile_destroyed_cb),
tile_destroyed_cb_data, (GClosureNotify) destroy_cb_data, 0);
callback_data = g_new (TileLoadedCallbackData, 1);
callback_data = g_slice_new (TileLoadedCallbackData);
callback_data->tile = tile;
callback_data->map_source = map_source;
......
......@@ -2075,7 +2075,7 @@ champlain_view_stop_go_to (ChamplainView *view)
g_signal_emit_by_name (view, "animation-completed::go-to", NULL);
g_free (priv->goto_context);
g_slice_free (GoToContext, priv->goto_context);
priv->goto_context = NULL;
}
......@@ -2128,7 +2128,7 @@ champlain_view_go_to_with_duration (ChamplainView *view,
champlain_view_stop_go_to (view);
ctx = g_new0 (GoToContext, 1);
ctx = g_slice_new (GoToContext);
ctx->from_latitude = priv->latitude;
ctx->from_longitude = priv->longitude;
ctx->to_latitude = latitude;
......@@ -2521,7 +2521,7 @@ view_load_visible_tiles (ChamplainView *view)
DEBUG ("Range %d, %d to %d, %d", x_first, y_first, x_end, y_end);
tile_map = g_new0 (gboolean, x_count * y_count);
tile_map = g_slice_alloc0 (sizeof (gboolean) * x_count * y_count);
/* Get rid of old tiles first */
children = clutter_container_get_children (CLUTTER_CONTAINER (priv->map_layer));
......@@ -2575,7 +2575,7 @@ view_load_visible_tiles (ChamplainView *view)
notify::state signal is connected */
champlain_tile_set_state (tile, CHAMPLAIN_STATE_LOADING);
data = g_new (FillTileCallbackData, 1);
data = g_slice_new (FillTileCallbackData);
data->tile = tile;
data->map_source = priv->map_source;
......@@ -2596,7 +2596,7 @@ view_load_visible_tiles (ChamplainView *view)
arm_size++;
}
g_free (tile_map);
g_slice_free1 (sizeof (gboolean) * x_count * y_count, tile_map);
}
......@@ -2614,7 +2614,7 @@ fill_tile_cb (FillTileCallbackData *data)
champlain_map_source_fill_tile (map_source, tile);
}
g_free (data);
g_slice_free (FillTileCallbackData, data);
g_object_unref (map_source);
return FALSE;
......
......@@ -198,7 +198,7 @@ image_downloaded_cb (SoupSession *session,
cleanup:
if (marker_data)
g_object_unref (marker_data->layer);
g_free (marker_data);
g_slice_free (MarkerData, marker_data);
g_free (url);
if (error != NULL)
......@@ -227,7 +227,7 @@ create_marker_from_url (ChamplainLayer *layer,
SoupMessage *message;
MarkerData *data;
data = g_new0 (MarkerData, 1);
data = g_slice_new (MarkerData);
data->layer = g_object_ref (layer);
data->latitude = latitude;
data->longitude = longitude;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment