Skip to content

Commit d802e56

Browse files
committed
Reverted to old code then changed to wh_test_print for cleaner hexdump output
1 parent 355cc00 commit d802e56

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/wh_utils.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,32 +141,19 @@ void wh_Utils_Hexdump(const char* initial, const uint8_t* ptr, size_t size)
141141
{
142142
#define HEXDUMP_BYTES_PER_LINE 16
143143
int count = 0;
144-
char line[80]; /* Buffer for a line of hex output */
145-
size_t linePos = 0;
146-
const char hex[] = "0123456789ABCDEF";
147-
148144
if(initial != NULL)
149145
WOLFHSM_CFG_PRINTF("%s",initial);
150146
while(size > 0) {
151-
if ((count % HEXDUMP_BYTES_PER_LINE) == 0) {
152-
linePos = 0;
153-
}
154-
line[linePos++] = hex[*ptr >> 4];
155-
line[linePos++] = hex[*ptr & 0x0F];
156-
line[linePos++] = ' ';
147+
WOLFHSM_CFG_PRINTF("%02X ", *ptr);
157148
ptr++;
158149
size --;
159150
count++;
160151
if (count % HEXDUMP_BYTES_PER_LINE == 0) {
161-
line[linePos++] = '\n';
162-
line[linePos] = '\0';
163-
WOLFHSM_CFG_PRINTF("%s", line);
152+
WOLFHSM_CFG_PRINTF("\n");
164153
}
165154
}
166155
if((count % HEXDUMP_BYTES_PER_LINE) != 0) {
167-
line[linePos++] = '\n';
168-
line[linePos] = '\0';
169-
WOLFHSM_CFG_PRINTF("%s", line);
156+
WOLFHSM_CFG_PRINTF("\n");
170157
}
171158
}
172159
#endif

0 commit comments

Comments
 (0)