diff libpurple/imgstore.h @ 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 7bd696193402
line wrap: on
line diff
--- a/libpurple/imgstore.h	Wed Apr 25 21:48:56 2007 +0000
+++ b/libpurple/imgstore.h	Wed Apr 25 22:23:29 2007 +0000
@@ -44,14 +44,16 @@
  * No ID is allocated when using this function.  If you need to reference the
  * image by an ID, use purple_imgstore_add_with_id() instead.
  *
- * @param data		Pointer to the image data.
+ * @param data		Pointer to the image data, which the imgstore will take
+ *                      ownership of and free as appropriate.  If you want a
+ *                      copy of the data, make it before calling this function.
  * @param size		Image data's size.
  * @param filename	Filename associated with image.
  *
  * @return The stored image.
  */
 PurpleStoredImage *
-purple_imgstore_add(gconstpointer data, size_t size, const char *filename);
+purple_imgstore_add(gpointer data, size_t size, const char *filename);
 
 /**
  * Add an image to the store, allocating an ID.
@@ -60,13 +62,15 @@
  * the image with purple_imgstore_unref_by_id() or purple_imgstore_unref()
  * for it to be freed.
  *
- * @param data		Pointer to the image data.
+ * @param data		Pointer to the image data, which the imgstore will take
+ *                      ownership of and free as appropriate.  If you want a
+ *                      copy of the data, make it before calling this function.
  * @param size		Image data's size.
  * @param filename	Filename associated with image.
 
  * @return ID for the image.
  */
-int purple_imgstore_add_with_id(gconstpointer data, size_t size, const char *filename);
+int purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename);
 
 /**
  * Retrieve an image from the store. The caller does not own a