From a63435f6cce3a11987c573a5e37d345f2fdd673a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 9 May 2015 15:02:45 +0100 Subject: [PATCH] Const-correctness in the debug functions! I'm finding missing constifications all over the place this week. Turns out that dmemdump() has been taking a non-const memory pointer ever since the beginning, and it's never come up until now. How silly. --- misc.c | 6 +++--- misc.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/misc.c b/misc.c index 0d5673b3..f3a0eedd 100644 --- a/misc.c +++ b/misc.c @@ -814,7 +814,7 @@ void safefree(void *ptr) #ifdef DEBUG extern void dputs(char *); /* defined in per-platform *misc.c */ -void debug_printf(char *fmt, ...) +void debug_printf(const char *fmt, ...) { char *buf; va_list ap; @@ -827,10 +827,10 @@ void debug_printf(char *fmt, ...) } -void debug_memdump(void *buf, int len, int L) +void debug_memdump(const void *buf, int len, int L) { int i; - unsigned char *p = buf; + const unsigned char *p = buf; char foo[17]; if (L) { int delta; diff --git a/misc.h b/misc.h index 2c60748c..4c6bd7ff 100644 --- a/misc.h +++ b/misc.h @@ -109,8 +109,8 @@ int match_ssh_id(int stringlen, const void *string, const char *id); */ #ifdef DEBUG -void debug_printf(char *fmt, ...); -void debug_memdump(void *buf, int len, int L); +void debug_printf(const char *fmt, ...); +void debug_memdump(const void *buf, int len, int L); #define debug(x) (debug_printf x) #define dmemdump(buf,len) debug_memdump (buf, len, 0); #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);