Mercurial > pidgin.yaz
diff libpurple/protocols/msn/notification.c @ 29350:99d1b433dba0
Keep CurrentMedia in a separate object outside of MsnUser that needs to
be allocated if a user has media. This makes MsnUser smaller by the
size of 3 pointers (apparently) for each buddy in your buddy list.
In practice it looks like less than 1% of MSN users have media set,
so this should save a little bit of memory.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 04 Feb 2010 00:15:41 +0000 |
parents | 23f6f80f45ed |
children | 08296b862f98 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c Wed Feb 03 22:48:03 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Thu Feb 04 00:15:41 2010 +0000 @@ -1613,7 +1613,7 @@ MsnUser *user; const char *passport; char *psm_str, *str; - CurrentMedia media = {CURRENT_MEDIA_UNKNOWN, NULL, NULL, NULL}; + CurrentMedia *media = NULL; session = cmdproc->session; account = session->account; @@ -1634,19 +1634,12 @@ g_free(psm_str); str = msn_get_currentmedia(cmd->payload, len); - if (msn_parse_currentmedia(str, &media)) - msn_user_set_currentmedia(user, &media); - else - msn_user_set_currentmedia(user, NULL); - g_free(media.title); - g_free(media.album); - g_free(media.artist); + media = msn_parse_currentmedia(str); g_free(str); - } else { msn_user_set_statusline(user, NULL); - msn_user_set_currentmedia(user, NULL); } + msn_user_set_currentmedia(user, media); msn_user_update(user); }