From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LT26d-0001sE-Cy for mharc-grub-devel@gnu.org; Fri, 30 Jan 2009 17:44:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LT26b-0001rZ-Ay for grub-devel@gnu.org; Fri, 30 Jan 2009 17:44:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LT26a-0001rJ-IG for grub-devel@gnu.org; Fri, 30 Jan 2009 17:44:57 -0500 Received: from [199.232.76.173] (port=54886 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LT26a-0001r9-As for grub-devel@gnu.org; Fri, 30 Jan 2009 17:44:56 -0500 Received: from mailout06.t-online.de ([194.25.134.19]:49268) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LT26Z-0004gS-Pf for grub-devel@gnu.org; Fri, 30 Jan 2009 17:44:56 -0500 Received: from fwd08.aul.t-online.de by mailout06.sul.t-online.de with smtp id 1LT26W-0005nz-00; Fri, 30 Jan 2009 23:44:52 +0100 Received: from [10.3.2.2] (VrhGJrZUQh+BafhMzskV0C61Rs3vkR6T1dfueoCi8Q0RasopQcU4WIcvl5ITx9ng5y@[217.235.197.250]) by fwd08.aul.t-online.de with esmtp id 1LT26S-1H78PQ0; Fri, 30 Jan 2009 23:44:48 +0100 Message-ID: <498382E1.8020107@t-online.de> Date: Fri, 30 Jan 2009 23:44:49 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------050308040202030009080304" X-ID: VrhGJrZUQh+BafhMzskV0C61Rs3vkR6T1dfueoCi8Q0RasopQcU4WIcvl5ITx9ng5y X-TOI-MSGID: 61871644-0af7-45e1-b003-869917adbf1d X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Skip identical lines in hexdump X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 22:44:57 -0000 This is a multi-part message in MIME format. --------------050308040202030009080304 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This skips identical lines in hexdump output, like 'od' or 'xxd -a' also do. Christian PS: I would suggest to change hexdump 'buf' parameter from 'char *' to 'const void *' to avoid unnecessary casts. 2009-01-30 Christian Franke * lib/hexdump.c (hexdump): Print at most 3 lines if data is identical. --------------050308040202030009080304 Content-Type: text/x-diff; name="grub2-hexdump-skip.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-hexdump-skip.patch" diff --git a/lib/hexdump.c b/lib/hexdump.c index 9b79f45..7689edf 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 of 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; --------------050308040202030009080304--