0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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)
This commit is contained in:
DungSaga 2021-10-18 13:16:03 +01:00 committed by Bram Moolenaar
parent e08aee60ab
commit 375c35a63f
2 changed files with 8 additions and 11 deletions

View File

@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3533,
/**/
3532,
/**/

View File

@ -302,9 +302,7 @@ huntype(
ign_garb = 0;
if (p >= cols)
{
if (!hextype)
if (!hextype && (p >= cols))
{
if (n1 < 0)
{
@ -314,9 +312,6 @@ huntype(
want_off = (want_off << 4) | n1;
continue;
}
else
p = 0;
}
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;