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[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3533,
/**/ /**/
3532, 3532,
/**/ /**/

View File

@ -302,20 +302,15 @@ huntype(
ign_garb = 0; ign_garb = 0;
if (p >= cols) if (!hextype && (p >= cols))
{ {
if (!hextype) if (n1 < 0)
{ {
if (n1 < 0) p = 0;
{
p = 0;
continue;
}
want_off = (want_off << 4) | n1;
continue; continue;
} }
else want_off = (want_off << 4) | n1;
p = 0; continue;
} }
if (base_off + want_off != have_off) if (base_off + want_off != have_off)
@ -344,7 +339,7 @@ huntype(
have_off++; have_off++;
want_off++; want_off++;
n1 = -1; n1 = -1;
if ((++p >= cols) && !hextype) if (!hextype && (++p >= cols))
{ {
/* skip the rest of the line as garbage */ /* skip the rest of the line as garbage */
n2 = -1; n2 = -1;