[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/etags_update_v2 eba8dbc 6/8: exit inner copying loop at the star
From: |
Dmitry Gutov |
Subject: |
feature/etags_update_v2 eba8dbc 6/8: exit inner copying loop at the start of a new file entry |
Date: |
Tue, 8 Dec 2020 16:48:02 -0500 (EST) |
branch: feature/etags_update_v2
commit eba8dbcbe547b19cd44250fbc3f996052ae48239
Author: Tom Tromey <tom@tromey.com>
Commit: Dmitry Gutov <dgutov@yandex.ru>
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 92cc190..1fa0447 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1680,22 +1680,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);
@@ -1716,13 +1716,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;
}
}
- branch feature/etags_update_v2 created (now 5844ad6), Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 0b3b015 2/8: constify some things, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 0d360e5 5/8: fix possible infinite loop in find_filename_hash_slot, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 ca38c06 3/8: make etags -u work in etags mode, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 06b20f7 1/8: etags.c indentation fix, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 eba8dbc 6/8: exit inner copying loop at the start of a new file entry,
Dmitry Gutov <=
- feature/etags_update_v2 fbe52da 7/8: Another -u fix, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 b658a3f 4/8: --find feature, Dmitry Gutov, 2020/12/08
- feature/etags_update_v2 5844ad6 8/8: Hopefully fix compilation errors, Dmitry Gutov, 2020/12/08