Remove unnecessary string dup. Fixes bug #577829
authorXavier Claessens <xclaesse@gmail.com>
Fri, 3 Apr 2009 12:49:53 +0000 (12:49 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 3 Apr 2009 12:49:53 +0000 (12:49 +0000)
From: Xavier Claessens <xclaesse@gmail.com>

svn path=/trunk/; revision=2757

libempathy-gtk/empathy-smiley-manager.c

index 9f7dd73c84d011eafdc1356bba0dbb9f62cf48f8..96b50206a710334a78b4f75c87354edc11bbb2ed 100644 (file)
@@ -79,8 +79,9 @@ smiley_manager_tree_free (SmileyManagerTree *tree)
        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 @@ smiley_new (GdkPixbuf *pixbuf, const gchar *str)
        if (pixbuf) {
                smiley->pixbuf = g_object_ref (pixbuf);
        }
-       smiley->str = g_strdup (str);
+       smiley->str = str;
 
        return smiley;
 }
@@ -229,7 +230,8 @@ smiley_manager_add_valist (EmpathySmileyManager *manager,
                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