changeset 18249:35d981091506

Prepend to lists for performance, and use g_list_reverse when the list is being built in reverse order (as opposed to random order, like when we're getting files from a readdir()) to improve the performance of the sort that'll happen later in the core logging code.
author Richard Laager <rlaager@wiktel.com>
date Sun, 24 Jun 2007 23:52:08 +0000
parents ab761acbc614
children 7a6a1da4121b
files libpurple/plugins/log_reader.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Sun Jun 24 23:40:09 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Sun Jun 24 23:52:08 2007 +0000
@@ -157,7 +157,7 @@
 					log->logger = adium_logger;
 					log->logger_data = data;
 
-					list = g_list_append(list, log);
+					list = g_list_prepend(list, log);
 				}
 			} else if (purple_str_has_suffix(file, ".adiumLog")) {
 				struct tm tm;
@@ -218,7 +218,7 @@
 					log->logger = adium_logger;
 					log->logger_data = data;
 
-					list = g_list_append(list, log);
+					list = g_list_prepend(list, log);
 				}
 			}
 		}
@@ -857,7 +857,7 @@
 			log->logger = msn_logger;
 			log->logger_data = data;
 
-			list = g_list_append(list, log);
+			list = g_list_prepend(list, log);
 		}
 		old_session_id = session_id;
 	}
@@ -865,7 +865,7 @@
 	if (data)
 		data->last_log = TRUE;
 
-	return list;
+	return g_list_reverse(list);
 }
 
 static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
@@ -1397,7 +1397,7 @@
 						log->logger = trillian_logger;
 						log->logger_data = data;
 
-						list = g_list_append(list, log);
+						list = g_list_prepend(list, log);
 					}
 				}
 			}
@@ -1412,7 +1412,7 @@
 
 	g_free(prpl_name);
 
-	return list;
+	return g_list_reverse(list);
 }
 
 static char * trillian_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
@@ -1892,7 +1892,7 @@
 							log->logger = qip_logger;
 							log->logger_data = data;
 
-							list = g_list_append(list, log);
+							list = g_list_prepend(list, log);
 
 							prev_tm = tm;
 							start_log = new_line;
@@ -1931,12 +1931,12 @@
 		log->logger = qip_logger;
 		log->logger_data = data;
 
-		list = g_list_append(list, log);
+		list = g_list_prepend(list, log);
 	}
 
 	g_free(contents);
 	g_free(path);
-	return list;
+	return g_list_reverse(list);
 }
 
 static char * qip_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)