Speed up by 10%.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Feb 2008 02:11:40 +0000 (03:11 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 18 Feb 2008 02:11:40 +0000 (03:11 +0100)
ChangeLog
lib/git-merge-changelog.c

index 2583f1a..437e4a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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%.
        * lib/git-merge-changelog.c (struct entry): New fields 'hashcode',
        'hashcode_cached'.
        * 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>
index 5f639ef..56e5511 100644 (file)
@@ -1505,11 +1505,14 @@ There is NO WARRANTY, to the extent permitted by law.\n\
        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))