Mercurial > pidgin.yaz
comparison src/log.c @ 11703:a53cef8bd22b
[gaim-migrate @ 13994]
Change some g_list_append()s to g_list_prepend()s, since the list is sorted later either way. Also, change the order of arguments to a couple g_list_concat()s to cut down on the number of list elements to walk. These changes may improve performance a bit if you have a lot of logs. They certainly don't make the code more confusing or uglier, so I didn't see much harm.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 20 Oct 2005 17:11:56 +0000 |
parents | a647f92e1d57 |
children | 52f27ffe68a5 |
comparison
equal
deleted
inserted
replaced
11702:994f1c7bee8b | 11703:a53cef8bd22b |
---|---|
374 GSList *n; | 374 GSList *n; |
375 for (n = loggers; n; n = n->next) { | 375 for (n = loggers; n; n = n->next) { |
376 GaimLogLogger *logger = n->data; | 376 GaimLogLogger *logger = n->data; |
377 if (!logger->list) | 377 if (!logger->list) |
378 continue; | 378 continue; |
379 logs = g_list_concat(logs, logger->list(type, name, account)); | 379 logs = g_list_concat(logger->list(type, name, account), logs); |
380 } | 380 } |
381 | 381 |
382 return g_list_sort(logs, gaim_log_compare); | 382 return g_list_sort(logs, gaim_log_compare); |
383 } | 383 } |
384 | 384 |
477 GSList *n; | 477 GSList *n; |
478 for (n = loggers; n; n = n->next) { | 478 for (n = loggers; n; n = n->next) { |
479 GaimLogLogger *logger = n->data; | 479 GaimLogLogger *logger = n->data; |
480 if (!logger->list_syslog) | 480 if (!logger->list_syslog) |
481 continue; | 481 continue; |
482 logs = g_list_concat(logs, logger->list_syslog(account)); | 482 logs = g_list_concat(logger->list_syslog(account), logs); |
483 } | 483 } |
484 | 484 |
485 return g_list_sort(logs, gaim_log_compare); | 485 return g_list_sort(logs, gaim_log_compare); |
486 } | 486 } |
487 | 487 |
612 | 612 |
613 log = gaim_log_new(type, name, account, NULL, stamp); | 613 log = gaim_log_new(type, name, account, NULL, stamp); |
614 log->logger = logger; | 614 log->logger = logger; |
615 log->logger_data = data = g_new0(GaimLogCommonLoggerData, 1); | 615 log->logger_data = data = g_new0(GaimLogCommonLoggerData, 1); |
616 data->path = g_build_filename(path, filename, NULL); | 616 data->path = g_build_filename(path, filename, NULL); |
617 list = g_list_append(list, log); | 617 list = g_list_prepend(list, log); |
618 } | 618 } |
619 } | 619 } |
620 g_dir_close(dir); | 620 g_dir_close(dir); |
621 g_free(path); | 621 g_free(path); |
622 return list; | 622 return list; |
672 if (!prpl) | 672 if (!prpl) |
673 continue; | 673 continue; |
674 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); | 674 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
675 | 675 |
676 if (!strcmp(protocol_unescaped, prpl_info->list_icon((GaimAccount *)account_iter->data, NULL))) | 676 if (!strcmp(protocol_unescaped, prpl_info->list_icon((GaimAccount *)account_iter->data, NULL))) |
677 accounts = g_list_append(accounts, account_iter->data); | 677 accounts = g_list_prepend(accounts, account_iter->data); |
678 } | 678 } |
679 g_free(protocol_unescaped); | 679 g_free(protocol_unescaped); |
680 | 680 |
681 while ((username = g_dir_read_name(protocol_dir)) != NULL) { | 681 while ((username = g_dir_read_name(protocol_dir)) != NULL) { |
682 gchar *username_path = g_build_filename(protocol_path, username, NULL); | 682 gchar *username_path = g_build_filename(protocol_path, username, NULL); |
1166 data = g_new0(struct old_logger_data, 1); | 1166 data = g_new0(struct old_logger_data, 1); |
1167 data->offset = lastoff; | 1167 data->offset = lastoff; |
1168 data->length = newlen; | 1168 data->length = newlen; |
1169 data->pathref = gaim_stringref_ref(pathref); | 1169 data->pathref = gaim_stringref_ref(pathref); |
1170 log->logger_data = data; | 1170 log->logger_data = data; |
1171 list = g_list_append(list, log); | 1171 list = g_list_prepend(list, log); |
1172 } | 1172 } |
1173 } | 1173 } |
1174 | 1174 |
1175 logfound = 1; | 1175 logfound = 1; |
1176 lastoff = offset; | 1176 lastoff = offset; |
1217 data = g_new0(struct old_logger_data, 1); | 1217 data = g_new0(struct old_logger_data, 1); |
1218 data->offset = lastoff; | 1218 data->offset = lastoff; |
1219 data->length = newlen; | 1219 data->length = newlen; |
1220 data->pathref = gaim_stringref_ref(pathref); | 1220 data->pathref = gaim_stringref_ref(pathref); |
1221 log->logger_data = data; | 1221 log->logger_data = data; |
1222 list = g_list_append(list, log); | 1222 list = g_list_prepend(list, log); |
1223 } | 1223 } |
1224 } | 1224 } |
1225 | 1225 |
1226 gaim_stringref_unref(pathref); | 1226 gaim_stringref_unref(pathref); |
1227 fclose(file); | 1227 fclose(file); |