]> www.infradead.org Git - mtd-utils.git/commit
nanddump: Refactor pretty print code into an sprintf()
authorBrian Norris <computersforpeace@gmail.com>
Mon, 29 Nov 2010 08:01:57 +0000 (00:01 -0800)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Thu, 2 Dec 2010 03:25:33 +0000 (05:25 +0200)
commit5a4d06c0fc94cf48d5bab3afa97b16c9022c4181
treeff442e859a02dcb6468b99c61d7d2ba9bdea7968
parent3941e9fd08f1d03a52f6584b70077ff0ac866696
nanddump: Refactor pretty print code into an sprintf()

A do-while loop in pretty_dump_to_buffer() can be refactored into a
single sprintf() statement. MAX() and MIN() are used to ensure that:
(1) We have at least a single space between hex and ASCII output
(2) We don't overflow the line buffer

This patch was suggested by Mike Frysinger.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
nanddump.c