Revision: 1968
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1968
Author:   chrfranke
Date:     2009-02-02 19:43:14 +0000 (Mon, 02 Feb 2009)

Log Message:
-----------
2009-02-02  Christian Franke  <[email protected]>

        * lib/hexdump.c (hexdump): Print at most 3 lines if data is identical.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/lib/hexdump.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-02-01 16:17:32 UTC (rev 1967)
+++ trunk/grub2/ChangeLog       2009-02-02 19:43:14 UTC (rev 1968)
@@ -1,3 +1,7 @@
+2009-02-02  Christian Franke  <[email protected]>
+
+       * lib/hexdump.c (hexdump): Print at most 3 lines if data is identical.
+
 2009-02-01  Felix Zielcke  <[email protected]>
 
        * INSTALL: Note that we now require at least autconf 2.59 and that LZO

Modified: trunk/grub2/lib/hexdump.c
===================================================================
--- trunk/grub2/lib/hexdump.c   2009-02-01 16:17:32 UTC (rev 1967)
+++ trunk/grub2/lib/hexdump.c   2009-02-02 19:43:14 UTC (rev 1968)
@@ -61,6 +61,22 @@
 
       grub_printf ("%s\n", line);
 
+      /* Print only first and last line if more than 3 lines are identical.  */
+      if (len >= 4 * 16
+         && ! grub_memcmp (buf, buf + 1 * 16, 16)
+         && ! grub_memcmp (buf, buf + 2 * 16, 16)
+         && ! grub_memcmp (buf, buf + 3 * 16, 16))
+       {
+         grub_printf ("*\n");
+         do
+           {
+             bse += 16;
+             buf += 16;
+             len -= 16;
+           }
+         while (len >= 3 * 16 && ! grub_memcmp (buf, buf + 2 * 16, 16));
+       }
+
       bse += 16;
       buf += 16;
       len -= cnt;




Reply via email to