From: chrfranke Date: Mon, 2 Feb 2009 19:43:14 +0000 (+0000) Subject: 2009-02-02 Christian Franke X-Git-Tag: 1.98~1152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b4315fb069a0fc6294acc4964e323aba8ddc5b88;p=thirdparty%2Fgrub.git 2009-02-02 Christian Franke * lib/hexdump.c (hexdump): Print at most 3 lines if data is identical. --- diff --git a/ChangeLog b/ChangeLog index ce45490ed..53ba5e67b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-02-02 Christian Franke + + * lib/hexdump.c (hexdump): Print at most 3 lines if data is identical. + 2009-02-01 Felix Zielcke * INSTALL: Note that we now require at least autconf 2.59 and that LZO diff --git a/lib/hexdump.c b/lib/hexdump.c index 9b79f45b8..c69cb093b 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -61,6 +61,22 @@ hexdump (unsigned long bse, char *buf, int len) 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;