From d395377a5dc1f71afbfb402f0cd6204467ffb7c0 Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Fri, 5 Aug 2022 10:14:55 +0200 Subject: [PATCH] logging: debug_dump: simplify --- src/debug.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 1a8edfad2..59e5155a0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -151,7 +151,6 @@ void debug_dump(void *lp, int len) char *p; int i, j, start; char Buff[81]; - char stuffBuff[10]; char tmpBuf[10]; _dprintf("Dump of %d=%x bytes\n", len, len); @@ -164,20 +163,8 @@ void debug_dump(void *lp, int len) /* display each character as hex value */ for (i = start, j = 0; j < 16; p++, i++, j++) { if (i < len) { - sprintf(tmpBuf, "%X", ((int)(*p) & 0xFF)); - - if (strlen((char *)tmpBuf) < 2) { - stuffBuff[0] = '0'; - stuffBuff[1] = tmpBuf[0]; - stuffBuff[2] = ' '; - stuffBuff[3] = '\0'; - } else { - stuffBuff[0] = tmpBuf[0]; - stuffBuff[1] = tmpBuf[1]; - stuffBuff[2] = ' '; - stuffBuff[3] = '\0'; - } - strcat(Buff, stuffBuff); + sprintf(tmpBuf, "%02X ", ((int)(*p) & 0xFF)); + strcat(Buff, tmpBuf); } else strcat(Buff, " "); if (j == 7) /* space between groups of 8 */