comparison libgaim/protocols/oscar/family_oservice.c @ 15107: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
comparison
equal deleted inserted replaced
15106:b2b0839f57d0 15107:f41cd6f78c60
274 if (rateclass->classid == id) 274 if (rateclass->classid == id)
275 return rateclass; 275 return rateclass;
276 } 276 }
277 277
278 return NULL; 278 return NULL;
279 }
280
281 static void
282 rateclass_addpair(struct rateclass *rateclass, guint16 group, guint16 type)
283 {
284 struct snacpair *snacpair;
285
286 snacpair = g_new(struct snacpair, 1);
287 snacpair->group = group;
288 snacpair->subtype = type;
289
290 rateclass->members = g_slist_prepend(rateclass->members, snacpair);
291 } 279 }
292 280
293 /* Subtype 0x0007 - Rate Parameters */ 281 /* Subtype 0x0007 - Rate Parameters */
294 static int 282 static int
295 rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 283 rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
324 * the new version hardcoded here. 312 * the new version hardcoded here.
325 */ 313 */
326 if (mod->version >= 3) 314 if (mod->version >= 3)
327 byte_stream_getrawbuf(bs, rateclass->unknown, sizeof(rateclass->unknown)); 315 byte_stream_getrawbuf(bs, rateclass->unknown, sizeof(rateclass->unknown));
328 316
317 rateclass->members = g_hash_table_new(g_direct_hash, g_direct_equal);
329 rateclass->last.tv_sec = 0; 318 rateclass->last.tv_sec = 0;
330 rateclass->last.tv_usec = 0; 319 rateclass->last.tv_usec = 0;
331 conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass); 320 conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass);
332 } 321 }
333 conn->rateclasses = g_slist_reverse(conn->rateclasses); 322 conn->rateclasses = g_slist_reverse(conn->rateclasses);
352 341
353 group = byte_stream_get16(bs); 342 group = byte_stream_get16(bs);
354 subtype = byte_stream_get16(bs); 343 subtype = byte_stream_get16(bs);
355 344
356 if (rateclass != NULL) 345 if (rateclass != NULL)
357 rateclass_addpair(rateclass, group, subtype); 346 g_hash_table_insert(rateclass->members,
347 GUINT_TO_POINTER((group << 16) + subtype),
348 GUINT_TO_POINTER(TRUE));
358 } 349 }
359 rateclass->members = g_slist_reverse(rateclass->members);
360 } 350 }
361 351
362 /* 352 /*
363 * We don't pass the rate information up to the client, as it really 353 * We don't pass the rate information up to the client, as it really
364 * doesn't care. The information is stored in the connection, however 354 * doesn't care. The information is stored in the connection, however