# HG changeset patch # User Bram Moolenaar # Date 1634560206 -7200 # Node ID 16aaed83522ab9ef82d9799e2288b557ea74d9bc # Parent 5080aec1406b78970fdbfa8ca2e7dc061b5201e4 patch 8.2.3533: inefficient code in xxd Commit: https://github.com/vim/vim/commit/375c35a63fdb91e8db2a9965f94d56ae87135fff Author: DungSaga Date: Mon Oct 18 13:16:03 2021 +0100 patch 8.2.3533: inefficient code in xxd Problem: Inefficient code in xxd. Solution: Don't use "p" when "hextype" is non-zero. (closes https://github.com/vim/vim/issues/9013) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3533, +/**/ 3532, /**/ 3531, diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -302,20 +302,15 @@ huntype( 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 @@ huntype( have_off++; want_off++; n1 = -1; - if ((++p >= cols) && !hextype) + if (!hextype && (++p >= cols)) { /* skip the rest of the line as garbage */ n2 = -1;