Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/oscar_data.c @ 32294:8d6630912021
Add two hash tables to the oscar code that deals with your server stored
buddy list. One hash table is indexed by a combination of group id and
buddy id. The other hash table is indexed by a combination of item type
and item name. This should reduce the number of times we iterate through
a linked list by A LOT.
This is a modified version of Oliver's patch from #4816.
Fixes #4816.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 20 Mar 2011 20:20:52 +0000 |
parents | 91d3b40a2f70 |
children |
comparison
equal
deleted
inserted
replaced
32293:36011b558d3e | 32294:8d6630912021 |
---|---|
44 | 44 |
45 aim_initsnachash(od); | 45 aim_initsnachash(od); |
46 od->snacid_next = 0x00000001; | 46 od->snacid_next = 0x00000001; |
47 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 47 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
48 od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); | 48 od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); |
49 | |
50 od->ssi.local.idx_gid_bid = g_hash_table_new(g_direct_hash, g_direct_equal); | |
51 od->ssi.local.idx_all_named_items = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | |
52 | |
53 od->ssi.official.idx_gid_bid = g_hash_table_new(g_direct_hash, g_direct_equal); | |
54 od->ssi.official.idx_all_named_items = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | |
49 | 55 |
50 /* | 56 /* |
51 * Register all the modules for this session... | 57 * Register all the modules for this session... |
52 */ | 58 */ |
53 aim__registermodule(od, misc_modfirst); /* load the catch-all first */ | 59 aim__registermodule(od, misc_modfirst); /* load the catch-all first */ |
124 aim__shutdownmodules(od); | 130 aim__shutdownmodules(od); |
125 | 131 |
126 g_hash_table_destroy(od->buddyinfo); | 132 g_hash_table_destroy(od->buddyinfo); |
127 g_hash_table_destroy(od->handlerlist); | 133 g_hash_table_destroy(od->handlerlist); |
128 | 134 |
135 g_hash_table_destroy(od->ssi.local.idx_gid_bid); | |
136 g_hash_table_destroy(od->ssi.local.idx_all_named_items); | |
137 | |
138 g_hash_table_destroy(od->ssi.official.idx_gid_bid); | |
139 g_hash_table_destroy(od->ssi.official.idx_all_named_items); | |
140 | |
129 g_free(od); | 141 g_free(od); |
130 } | 142 } |
131 | 143 |
132 void | 144 void |
133 oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) | 145 oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) |