BUG: Walking logic in check() is broken. Moving aligning into source, removing macros

This commit is contained in:
Imbus 2025-09-09 08:47:26 +02:00
parent d608a81674
commit 04c8311528
6 changed files with 115 additions and 46 deletions

35
freelist/hexdump.c Normal file
View file

@ -0,0 +1,35 @@
#include <ctype.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
void hexdump(const void *data, size_t size) {
const unsigned char *p = (const unsigned char *)data;
size_t i, j;
for (i = 0; i < size; i += 16) {
// Print offset
printf("%08zx ", i);
// Print hex bytes
for (j = 0; j < 16; j++) {
if (i + j < size) {
printf("%02x ", p[i + j]);
} else {
printf(" "); // padding for incomplete lines
}
if (j == 7)
printf(" "); // extra space in middle
}
printf(" |");
// Print ASCII characters
for (j = 0; j < 16 && i + j < size; j++) {
unsigned char c = p[i + j];
printf("%c", isprint(c) ? c : '.');
}
printf("|\n");
}
}