diff options
author | DungSaga <dungsaga@users.noreply.github.com> | 2021-10-18 13:16:03 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-18 13:16:03 +0100 |
commit | 375c35a63fdb91e8db2a9965f94d56ae87135fff (patch) | |
tree | 95ec06f0511021fd9db3aef4174d173b4ce0c7f3 /src/xxd/xxd.c | |
parent | e08aee60abc59f517d3e263fdb9ba4a0196d507c (diff) | |
download | vim-git-375c35a63fdb91e8db2a9965f94d56ae87135fff.tar.gz |
patch 8.2.3533: inefficient code in xxdv8.2.3533
Problem: Inefficient code in xxd.
Solution: Don't use "p" when "hextype" is non-zero. (closes #9013)
Diffstat (limited to 'src/xxd/xxd.c')
-rw-r--r-- | src/xxd/xxd.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index 4e352034e..749df435d 100644 --- 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; |