Commit eaa5ce8b43e0 ("p2v: Break long lines when displaying virt-v2v
output in GUI.", 2016-01-08) introduced *line breaking* as a workaround
for a GTK2 regression, under which the handling of long lines from the
virt-v2v log would slow down very much.
Commit e09b955bdbbc ("p2v: Use virt-v2v --colours option, support colour
in the run dialog (RHBZ#1314244).", 2016-06-18) silently changed the *line
breaking* workaround into *line truncation*, also adopting a much shorter
cut-off length (replacing 1024 with 256).
Now, whether this logic remains useful is untestable today. That's
because commit 9b057cc1ac5f ("p2v: Don't display debugging messages in the
run dialog.", 2016-06-18), from the same series as the one that commit
e09b955bdbbc belonged to [*], had relegated the verbose & trace messages
-- IOW, all the long lines -- from the GUI to the conversion log file
(except maybe the last 50 lines of a failed conversion's log).
[*]
https://bugzilla.redhat.com/show_bug.cgi?id=1314244#c4
Therefore, the line truncation workaround may have become effectively
useless right at the end of that series, and stays most probably dead code
today, regardless of the GTK version used.
This is relevant because we want to remove GTK2 support from virt-p2v.
Some evidence would be nice as to whether the line truncation is obsolete
due to (a) GTK3 not suffering from the long line slowdown, or (b) GTK3
still having the bug, but the bug not being triggered due to commit
9b057cc1ac5f. Either way -- that is, even though this is untestable --,
just remove the truncating state from the v2v message parsing automaton.
The truncating state is only reachable from the normal state, and it also
returns to the normal state, so the removal is not complicated. Remove
the "dots" helper variable too. The (static) variable "linelen" is
only
consumed in the normal->truncating transition condition, so drop that one
as well.
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
gui.c | 26 --------------------
1 file changed, 26 deletions(-)
diff --git a/gui.c b/gui.c
index 4faaa710ed90..1e2cd3f94c62 100644
--- a/gui.c
+++ b/gui.c
@@ -2026,7 +2026,6 @@ add_v2v_output (gpointer user_data)
{
CLEANUP_FREE const char *msg = user_data;
const char *p;
- static size_t linelen = 0;
static enum {
state_normal,
state_escape1, /* seen ESC, expecting [ */
@@ -2036,13 +2035,11 @@ add_v2v_output (gpointer user_data)
state_escape5, /* seen ESC [ 0/1 ; 3, expecting 1/2/4/5 */
state_escape6, /* seen ESC [ 0/1 ; 3 1/2/5/5, expecting m */
state_cr, /* seen CR */
- state_truncating, /* truncating line until next \n */
} state = state_normal;
static int colour = 0;
static GtkTextTag *tag = NULL;
GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (v2v_output));
GtkTextIter iter, iter2;
- const char *dots = " [...]";
for (p = msg; *p != '\0'; ++p) {
char c = *p;
@@ -2055,22 +2052,7 @@ add_v2v_output (gpointer user_data)
state = state_escape1;
colour = 0;
}
- else if (c != '\n' && linelen >= 256) {
- /* Gtk2 (in ~ Fedora 23) has a regression where it takes much
- * longer to display long lines, to the point where the
- * virt-p2v UI would still be slowly displaying kernel modules
- * while the conversion had finished. For this reason,
- * arbitrarily truncate very long lines.
- */
- gtk_text_buffer_get_end_iter (buf, &iter);
- gtk_text_buffer_insert_with_tags (buf, &iter,
- dots, strlen (dots), tag, NULL);
- state = state_truncating;
- colour = 0;
- tag = NULL;
- }
else { /* Treat everything else as a normal char. */
- if (c != '\n') linelen++; else linelen = 0;
gtk_text_buffer_get_end_iter (buf, &iter);
gtk_text_buffer_insert_with_tags (buf, &iter, &c, 1, tag, NULL);
}
@@ -2134,7 +2116,6 @@ add_v2v_output (gpointer user_data)
/* Process CRLF as single a newline character. */
p--;
else { /* Delete current (== last) line. */
- linelen = 0;
gtk_text_buffer_get_end_iter (buf, &iter);
iter2 = iter;
gtk_text_iter_set_line_offset (&iter, 0);
@@ -2143,13 +2124,6 @@ add_v2v_output (gpointer user_data)
}
state = state_normal;
break;
-
- case state_truncating:
- if (c == '\n') {
- p--;
- state = state_normal;
- }
- break;
} /* switch (state) */
} /* for */