Mercurial > pidgin.yaz
diff libpurple/account.c @ 23963:d1797f30960f
An optimization for purple_accounts_find() to eliminate a malloc/free per
iteration from Florian Queze. Fixes #6194.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 31 Aug 2008 17:54:21 +0000 |
parents | 7097bbac4234 |
children | 8282911d5e17 |
line wrap: on
line diff
--- a/libpurple/account.c Sun Aug 31 17:29:40 2008 +0000 +++ b/libpurple/account.c Sun Aug 31 17:54:21 2008 +0000 @@ -2614,18 +2614,18 @@ for (l = purple_accounts_get_all(); l != NULL; l = l->next) { account = (PurpleAccount *)l->data; + if (protocol_id && strcmp(account->protocol_id, protocol_id)) + continue; who = g_strdup(purple_normalize(account, name)); - if (!strcmp(purple_normalize(account, purple_account_get_username(account)), who) && - (!protocol_id || !strcmp(account->protocol_id, protocol_id))) { + if (!strcmp(purple_normalize(account, purple_account_get_username(account)), who)) { g_free(who); - break; + return account; } g_free(who); - account = NULL; } - return account; + return NULL; } void