diff mbox

[U-Boot,02/20] Update print_buffer() to use const

Message ID 1356548233-5570-3-git-send-email-sjg@chromium.org
State Superseded, archived
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Dec. 26, 2012, 6:56 p.m. UTC
The buffer cannot be changed by this function, so change the buffer
pointer to a const. This allows callers with const pointer to use the
function without a cast.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 include/common.h      |    3 ++-
 lib/display_options.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Simon Glass Feb. 15, 2013, 11:49 p.m. UTC | #1
On Wed, Dec 26, 2012 at 10:56 AM, Simon Glass <sjg@chromium.org> wrote:
> The buffer cannot be changed by this function, so change the buffer
> pointer to a const. This allows callers with const pointer to use the
> function without a cast.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to x86/master.
diff mbox

Patch

diff --git a/include/common.h b/include/common.h
index d0bf1e8..f2035c0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -270,7 +270,8 @@  int	cpu_init(void);
 phys_size_t initdram (int);
 int	display_options (void);
 void	print_size(unsigned long long, const char *);
-int	print_buffer (ulong addr, void* data, uint width, uint count, uint linelen);
+int print_buffer(ulong addr, const void *data, uint width, uint count,
+		 uint linelen);
 
 /* common/main.c */
 void	main_loop	(void);
diff --git a/lib/display_options.c b/lib/display_options.c
index 694d2f2..0339970 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -98,7 +98,8 @@  void print_size(unsigned long long size, const char *s)
  */
 #define MAX_LINE_LENGTH_BYTES (64)
 #define DEFAULT_LINE_LENGTH_BYTES (16)
-int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen)
+int print_buffer(ulong addr, const void *data, uint width, uint count,
+		 uint linelen)
 {
 	/* linebuf as a union causes proper alignment */
 	union linebuf {