[grilo-plugins] [flickr] Use g_slices when possible
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] [flickr] Use g_slices when possible
- Date: Tue, 27 Apr 2010 12:15:43 +0000 (UTC)
commit 061b87a96e3f02560ea9179f79045727639bbdbc
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue Apr 27 12:42:34 2010 +0200
[flickr] Use g_slices when possible
Memory slices are more efficient than mallocs.
src/flickr/gflickr.c | 8 ++++----
src/flickr/grl-flickr.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/flickr/gflickr.c b/src/flickr/gflickr.c
index 6e98661..4053542 100644
--- a/src/flickr/gflickr.c
+++ b/src/flickr/gflickr.c
@@ -244,7 +244,7 @@ process_photo_result (const gchar *xml_result, gpointer user_data)
data->get_info_cb (NULL, photo, data->user_data);
g_hash_table_unref (photo);
}
- g_free (data);
+ g_slice_free (GFlickrData, data);
xmlFreeDoc (doc);
}
@@ -279,7 +279,7 @@ process_photolist_result (const gchar *xml_result, gpointer user_data)
g_list_foreach (photolist, (GFunc) g_hash_table_unref, NULL);
g_list_free (photolist);
}
- g_free (data);
+ g_slice_free (GFlickrData, data);
xmlFreeDoc (doc);
}
@@ -345,7 +345,7 @@ g_flickr_photos_getInfo (GFlickr *f,
photo_id);
g_free (api_sig);
- GFlickrData *gfd = g_new (GFlickrData, 1);
+ GFlickrData *gfd = g_slice_new (GFlickrData);
gfd->parse_xml = process_photo_result;
gfd->get_info_cb = callback;
gfd->user_data = user_data;
@@ -375,7 +375,7 @@ g_flickr_photos_search (GFlickr *f,
text);
g_free (api_sig);
- GFlickrData *gfd = g_new (GFlickrData, 1);
+ GFlickrData *gfd = g_slice_new (GFlickrData);
gfd->parse_xml = process_photolist_result;
gfd->search_cb = callback;
gfd->user_data = user_data;
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index 11ac1e3..5cd12bd 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -268,7 +268,7 @@ search_cb (GFlickr *f, GList *photolist, gpointer user_data)
0,
sd->ss->user_data,
NULL);
- g_free (sd);
+ g_slice_free (SearchData, sd);
return;
}
@@ -296,7 +296,7 @@ search_cb (GFlickr *f, GList *photolist, gpointer user_data)
sd->page++;
g_flickr_photos_search (f, sd->ss->text, sd->page, search_cb, sd);
} else {
- g_free (sd);
+ g_slice_free (SearchData, sd);
}
}
@@ -347,7 +347,7 @@ grl_flickr_source_search (GrlMediaSource *source,
per_page = CLAMP (1 + ss->skip + ss->count, 0, 100);
g_flickr_set_per_page (f, per_page);
- SearchData *sd = g_new (SearchData, 1);
+ SearchData *sd = g_slice_new (SearchData);
sd->page = 1 + (ss->skip / per_page);
sd->offset = ss->skip % per_page;
sd->ss = ss;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]