[grilo-plugins] [vimeo] Use g_slices when possible
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] [vimeo] Use g_slices when possible
- Date: Fri, 30 Apr 2010 14:52:32 +0000 (UTC)
commit e7899afdac7b92ef11ce8458aa197ac60ab7ed14
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Fri Apr 30 16:32:51 2010 +0200
[vimeo] Use g_slices when possible
Memory slices are more efficient than mallocs.
src/vimeo/grl-vimeo.c | 6 +++---
src/vimeo/gvimeo.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index c929163..2f93105 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -270,7 +270,7 @@ search_cb (GVimeo *vimeo, GList *video_list, gpointer user_data)
0,
sd->ss->user_data,
NULL);
- g_free (sd);
+ g_slice_free (SearchData, sd);
return;
}
@@ -305,7 +305,7 @@ search_cb (GVimeo *vimeo, GList *video_list, gpointer user_data)
}
else
{
- g_free (sd);
+ g_slice_free (SearchData, sd);
}
}
@@ -382,7 +382,7 @@ grl_vimeo_source_search (GrlMediaSource *source,
per_page = CLAMP (1 + ss->skip + ss->count, 0, 100);
g_vimeo_set_per_page (vimeo, per_page);
- sd = g_new (SearchData, 1);
+ sd = g_slice_new (SearchData);
sd->page = 1 + (ss->skip / per_page);
sd->offset = ss->skip % per_page;
sd->ss = ss;
diff --git a/src/vimeo/gvimeo.c b/src/vimeo/gvimeo.c
index 4ce67f9..0149775 100644
--- a/src/vimeo/gvimeo.c
+++ b/src/vimeo/gvimeo.c
@@ -351,7 +351,7 @@ process_video_search_result (const gchar *xml_result, gpointer user_data)
g_list_foreach (video_list, (GFunc) g_hash_table_unref, NULL);
g_list_free (video_list);
}
- g_free (data);
+ g_slice_free (GVimeoVideoSearchData, data);
xmlFreeDoc (doc);
}
@@ -405,7 +405,7 @@ get_video_play_url_complete_cb (SoupSession *session,
url = get_play_url_from_vimeo_xml (message->response_body->data,
url_data->video_id);
url_data->callback (url, url_data->user_data);
- g_free (url_data);
+ g_slice_free (GVimeoVideoURLData, url_data);
}
static gchar *
@@ -472,7 +472,7 @@ g_vimeo_videos_search (GVimeo *vimeo,
g_return_if_fail (G_IS_VIMEO (vimeo));
request = build_request (vimeo, text, page);
- search_data = g_new (GVimeoVideoSearchData, 1);
+ search_data = g_slice_new (GVimeoVideoSearchData);
search_data->vimeo = vimeo;
search_data->search_cb = callback;
search_data->user_data = user_data;
@@ -499,7 +499,7 @@ g_vimeo_video_get_play_url (GVimeo *vimeo,
SoupMessageHeaders *headers = message->request_headers;
soup_message_headers_append (headers, "User-Agent", PLUGIN_USER_AGENT);
- data = g_new (GVimeoVideoURLData, 1);
+ data = g_slice_new (GVimeoVideoURLData);
data->video_id = id;
data->vimeo = vimeo;
data->callback = callback;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]