Mercurial > pidgin
diff libgaim/protocols/oscar/family_oservice.c @ 15106:f41cd6f78c60
[gaim-migrate @ 17892]
Use GHashTable and GQueue instead of GSList in a few places in
oscar. The speed improvements probably won't be noticeable.
4 files changed, 48 insertions(+), 106 deletions(-)
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 04 Dec 2006 11:14:11 +0000 |
parents | 525607f86cce |
children | fbfdbde296b0 |
line wrap: on
line diff
--- a/libgaim/protocols/oscar/family_oservice.c Mon Dec 04 07:47:50 2006 +0000 +++ b/libgaim/protocols/oscar/family_oservice.c Mon Dec 04 11:14:11 2006 +0000 @@ -278,18 +278,6 @@ return NULL; } -static void -rateclass_addpair(struct rateclass *rateclass, guint16 group, guint16 type) -{ - struct snacpair *snacpair; - - snacpair = g_new(struct snacpair, 1); - snacpair->group = group; - snacpair->subtype = type; - - rateclass->members = g_slist_prepend(rateclass->members, snacpair); -} - /* Subtype 0x0007 - Rate Parameters */ static int rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) @@ -326,6 +314,7 @@ if (mod->version >= 3) byte_stream_getrawbuf(bs, rateclass->unknown, sizeof(rateclass->unknown)); + rateclass->members = g_hash_table_new(g_direct_hash, g_direct_equal); rateclass->last.tv_sec = 0; rateclass->last.tv_usec = 0; conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass); @@ -354,9 +343,10 @@ subtype = byte_stream_get16(bs); if (rateclass != NULL) - rateclass_addpair(rateclass, group, subtype); + g_hash_table_insert(rateclass->members, + GUINT_TO_POINTER((group << 16) + subtype), + GUINT_TO_POINTER(TRUE)); } - rateclass->members = g_slist_reverse(rateclass->members); } /*