empathy r2757 - trunk/libempathy-gtk



Author: xclaesse
Date: Fri Apr  3 12:49:53 2009
New Revision: 2757
URL: http://svn.gnome.org/viewvc/empathy?rev=2757&view=rev

Log:
Remove unnecessary string dup. Fixes bug #577829

From: Xavier Claessens <xclaesse gmail com>

Modified:
   trunk/libempathy-gtk/empathy-smiley-manager.c

Modified: trunk/libempathy-gtk/empathy-smiley-manager.c
==============================================================================
--- trunk/libempathy-gtk/empathy-smiley-manager.c	(original)
+++ trunk/libempathy-gtk/empathy-smiley-manager.c	Fri Apr  3 12:49:53 2009
@@ -79,8 +79,9 @@
 	g_slice_free (SmileyManagerTree, tree);
 }
 
+/* Note: This function takes the ownership of str */
 static EmpathySmiley *
-smiley_new (GdkPixbuf *pixbuf, const gchar *str)
+smiley_new (GdkPixbuf *pixbuf, gchar *str)
 {
 	EmpathySmiley *smiley;
 
@@ -88,7 +89,7 @@
 	if (pixbuf) {
 		smiley->pixbuf = g_object_ref (pixbuf);
 	}
-	smiley->str = g_strdup (str);
+	smiley->str = str;
 
 	return smiley;
 }
@@ -229,7 +230,8 @@
 		smiley_manager_tree_insert (priv->tree, smiley, str);
 	}
 
-	priv->smileys = g_slist_prepend (priv->smileys, smiley_new (smiley, first_str));
+	priv->smileys = g_slist_prepend (priv->smileys,
+		smiley_new (smiley, g_strdup (first_str)));
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]