patch 8.2.3533: inefficient code in xxd
Problem: Inefficient code in xxd.
Solution: Don't use "p" when "hextype" is non-zero. (closes #9013)
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 4e35203..749df43 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -302,20 +302,15 @@
ign_garb = 0;
- if (p >= cols)
+ if (!hextype && (p >= cols))
{
- if (!hextype)
+ if (n1 < 0)
{
- if (n1 < 0)
- {
- p = 0;
- continue;
- }
- want_off = (want_off << 4) | n1;
+ p = 0;
continue;
}
- else
- p = 0;
+ want_off = (want_off << 4) | n1;
+ continue;
}
if (base_off + want_off != have_off)
@@ -344,7 +339,7 @@
have_off++;
want_off++;
n1 = -1;
- if ((++p >= cols) && !hextype)
+ if (!hextype && (++p >= cols))
{
/* skip the rest of the line as garbage */
n2 = -1;