emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/etags-update ee15b78: exit inner copying loop at t


From: Tom Tromey
Subject: [Emacs-diffs] feature/etags-update ee15b78: exit inner copying loop at the start of a new file entry
Date: Sat, 20 Jan 2018 18:53:21 -0500 (EST)

branch: feature/etags-update
commit ee15b78cf6913e4f34306c9295cbd10cdec749e9
Author: Tom Tromey <address@hidden>
Commit: Tom Tromey <address@hidden>

    exit inner copying loop at the start of a new file entry
---
 lib-src/etags.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 982e3a0..6479e2f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1666,22 +1666,22 @@ static void
 copy_entries_from_old_file (FILE *old_file, const char *old_filename, FILE 
*out_file)
 {
   linebuffer line;
+  bool keep_going = true;
 
   need_filebuf = false;
 
   linebuffer_init (&line);
-  while (true)
+
+  if (readline_internal (&line, old_file, old_filename) <= 0
+      || line.len < 1 || !strneq (line.buffer, "\f", 1))
+    goto error;
+
+  while (keep_going)
     {
       char *comma, *filename;
       bool should_copy;
 
       if (readline_internal (&line, old_file, old_filename) <= 0)
-       break;
-
-      if (line.len < 1 || !strneq (line.buffer, "\f", 1))
-       goto error;
-
-      if (readline_internal (&line, old_file, old_filename) <= 0)
        goto error;
 
       comma = memchr (line.buffer, ',', line.len);
@@ -1702,13 +1702,19 @@ copy_entries_from_old_file (FILE *old_file, const char 
*old_filename, FILE *out_
       while (true)
        {
          if (readline_internal (&line, old_file, old_filename) <= 0)
-           break;
+           {
+             keep_going = false;
+             break;
+           }
 
          if (should_copy)
            {
              fwrite (line.buffer, line.len, 1, out_file);
              fputs ("\n", out_file);
            }
+
+         if (line.len < 0 || strneq (line.buffer, "\f", 1))
+           break;
        }
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]