changeset 9714:5122118a6300

Speed up by 10%.
author Bruno Haible <bruno@clisp.org>
date Mon, 18 Feb 2008 03:11:40 +0100
parents 9bd638fc6986
children e87d8b41f0fe
files ChangeLog lib/git-merge-changelog.c
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-17  Bruno Haible  <bruno@clisp.org>
+
+	Speed up by 10%.
+	* lib/git-merge-changelog.c (main): Use the iterator to iterate through
+	result_entries, rather than an index-based loop.
+
 2008-02-17  Bruno Haible  <bruno@clisp.org>
 
 	Speed up by 25%.
@@ -23769,4 +23775,4 @@
 	* lib/regexec.c (build_trtable): Remove "#ifdef _LIBC", since the code
 	now works outside glibc.
 
-2005-08-25  Paul Eggert  <eggert@cs.ucla.edu>
\ No newline at end of file
+2005-08-25  Paul Eggert  <eggert@cs.ucla.edu>
--- a/lib/git-merge-changelog.c
+++ b/lib/git-merge-changelog.c
@@ -1505,11 +1505,14 @@
 	for (i = 0; i < n; i++)
 	  conflict_write (fp, (struct conflict *) gl_list_get_at (result_conflicts, i));
       }
+      /* Output the modified and unmodified entries, in order.  */
       {
-	size_t n = gl_list_size (result_entries);
-	size_t i;
-	for (i = 0; i < n; i++)
-	  entry_write (fp, (struct entry *) gl_list_get_at (result_entries, i));
+	gl_list_iterator_t iter = gl_list_iterator (result_entries);
+	const void *elt;
+	gl_list_node_t node;
+	while (gl_list_iterator_next (&iter, &elt, &node))
+	  entry_write (fp, (struct entry *) elt);
+	gl_list_iterator_free (&iter);
       }
 
       if (fwriteerror (fp))