]> granicus.if.org Git - vim/commitdiff
patch 8.2.3533: inefficient code in xxd v8.2.3533
authorDungSaga <dungsaga@users.noreply.github.com>
Mon, 18 Oct 2021 12:16:03 +0000 (13:16 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 18 Oct 2021 12:16:03 +0000 (13:16 +0100)
Problem:    Inefficient code in xxd.
Solution:   Don't use "p" when "hextype" is non-zero. (closes #9013)

src/version.c
src/xxd/xxd.c

index 53b902acac627cab808772980907c7f2c945b882..b84aef5c6d6ebc0311ce290cd4e9fcc90ca33406 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3533,
 /**/
     3532,
 /**/
index 4e352034edb71409f5f188fff829f703b7a9df4d..749df435d2f6a323d5e94f2875d4abf9f6a7a0e5 100644 (file)
@@ -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;