Mercurial > pidgin
diff libpurple/protocols/irc/msgs.c @ 22732:8d3c68a8eed4
Avoid allocating and freeing stuff unnecessarily.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 25 Apr 2008 18:01:50 +0000 |
parents | cd682b57b6e4 |
children | 1fbc49b46e09 |
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c Fri Apr 25 17:57:54 2008 +0000 +++ b/libpurple/protocols/irc/msgs.c Fri Apr 25 18:01:50 2008 +0000 @@ -706,14 +706,14 @@ void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - char *nick = irc_mask_nick(from); + GHashTable *components; + gchar *nick; - if (!args || !args[1] || !gc) { - g_free(nick); - g_hash_table_destroy(components); + if (!args || !args[1] || !gc) return; - } + + components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + nick = irc_mask_nick(from); g_hash_table_insert(components, g_strdup("channel"), g_strdup(args[1]));