diff libpurple/imgstore.c @ 16391:24bbd7e46bfe

Change the imgstore and by extension, then the buddy icon code to take over the references to icon data instead of calling g_memdup(). This eliminates g_memdup()ing and g_free()ing in ~50% of the callers. For the rest, it's no worse (they now do a g_memdup() instead of the core) and they may be able to be modified in the future to avoid that.
author Richard Laager <rlaager@wiktel.com>
date Wed, 25 Apr 2007 22:23:29 +0000
parents 4fc51a87ce42
children 2ae39a056179
line wrap: on
line diff
--- a/libpurple/imgstore.c	Wed Apr 25 21:48:56 2007 +0000
+++ b/libpurple/imgstore.c	Wed Apr 25 22:23:29 2007 +0000
@@ -48,7 +48,7 @@
 };
 
 PurpleStoredImage *
-purple_imgstore_add(gconstpointer data, size_t size, const char *filename)
+purple_imgstore_add(gpointer data, size_t size, const char *filename)
 {
 	PurpleStoredImage *img;
 
@@ -56,7 +56,7 @@
 	g_return_val_if_fail(size > 0, 0);
 
 	img = g_new(PurpleStoredImage, 1);
-	img->data = g_memdup(data, size);
+	img->data = data;
 	img->size = size;
 	img->filename = g_strdup(filename);
 	img->refcount = 1;
@@ -66,7 +66,7 @@
 }
 
 int
-purple_imgstore_add_with_id(gconstpointer data, size_t size, const char *filename)
+purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename)
 {
 	PurpleStoredImage *img = purple_imgstore_add(data, size, filename);
 	img->id = ++nextid;