Mercurial > pidgin.yaz
diff libpurple/protocols/myspace/myspace.c @ 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 | 105305518622 |
children | 94a2a1ccd6ec 315151da0dc6 |
line wrap: on
line diff
--- 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);