changeset 19466:11c727b19201

Replace homegrown str_replace() with purple_strreplace(), after discovering it.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 27 Aug 2007 07:03:28 +0000
parents d9d9283680a4
children 286438542b24 fb69c4dd757e
files libpurple/protocols/myspace/markup.c libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h
diffstat 3 files changed, 2 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/markup.c	Mon Aug 27 06:58:54 2007 +0000
+++ b/libpurple/protocols/myspace/markup.c	Mon Aug 27 07:03:28 2007 +0000
@@ -645,7 +645,7 @@
 		purple_debug_info("msim", "msim_convert_smileys_to_markup: %s->%s\n",
 				symbol ? symbol : "(NULL)", 
 				replacement ? replacement : "(NULL)");
-		new = str_replace(old, symbol, replacement);
+		new = purple_strreplace(old, symbol, replacement);
 		
 		g_free(replacement);
 		g_free(old);
--- a/libpurple/protocols/myspace/myspace.c	Mon Aug 27 06:58:54 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Mon Aug 27 07:03:28 2007 +0000
@@ -178,32 +178,6 @@
 	return "myspace";
 }
 
-/**
- * Replace 'old' with 'new' in 'str'.
- *
- * @param str The original string.
- * @param old The substring of 'str' to replace.
- * @param new The replacement for 'old' within 'str'.
- *
- * @return A _new_ string, based on 'str', with 'old' replaced
- *         by 'new'. Must be g_free()'d by caller.
- *
- * This string replace method is based on
- * http://mail.gnome.org/archives/gtk-app-devel-list/2000-July/msg00201.html
- *
- */
-gchar *
-str_replace(const gchar *str, const gchar *old, const gchar *new)
-{
-	gchar **items;
-	gchar *ret;
-
-	items = g_strsplit(str, old, -1);
-	ret = g_strjoinv(new, items);
-	g_free(items);
-	return ret;
-}
-
 #ifdef MSIM_DEBUG_MSG
 static void 
 print_hash_item(gpointer key, gpointer value, gpointer user_data)
@@ -1955,7 +1929,7 @@
 		fmt_string = msim_msg_pack_element_data(elem);
 
 		uid_str = g_strdup_printf("%d", uid);
-		new_str = str_replace(fmt_string, "<uid>", uid_str);
+		new_str = purple_strreplace(fmt_string, "<uid>", uid_str);
 		g_free(uid_str);
 		g_free(fmt_string);
 
--- a/libpurple/protocols/myspace/myspace.h	Mon Aug 27 06:58:54 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Mon Aug 27 07:03:28 2007 +0000
@@ -193,8 +193,6 @@
 };
 #endif
 
-gchar *str_replace(const gchar *str, const gchar *old, const gchar *new);
-
 /* Functions */
 gboolean msim_load(PurplePlugin *plugin);
 GList *msim_status_types(PurpleAccount *acct);