Mercurial > vim
changeset 26000:16aaed83522a v8.2.3533
patch 8.2.3533: inefficient code in xxd
Commit: https://github.com/vim/vim/commit/375c35a63fdb91e8db2a9965f94d56ae87135fff
Author: DungSaga <dungsaga@users.noreply.github.com>
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 18 Oct 2021 14:30:06 +0200 |
parents | 5080aec1406b |
children | 9be59f48e627 |
files | src/version.c src/xxd/xxd.c |
diffstat | 2 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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,
--- 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;