diff --git a/c-programming/mem/safe_mem.test.c b/c-programming/mem/safe_mem.test.c index e8b0f9e..337ab38 100644 --- a/c-programming/mem/safe_mem.test.c +++ b/c-programming/mem/safe_mem.test.c @@ -18,10 +18,10 @@ #define PRINT_POINTER(caption, ptr) \ printf(caption " = %p\n", (void*) ptr); -#define DUMP_INT_ARRAY(caption, ptr, count) do { \ +#define DUMP_INT_ARRAY(caption, ptr, count, fmt) do { \ printf("%s: [", caption); \ for (size_t i = 0; i < count; i++) { \ - printf("%d", ptr[i]); \ + printf(fmt, ptr[i]); \ if (i != (count - 1)) \ printf(", "); \ } \ @@ -37,7 +37,8 @@ int main(void) { integers[1] = EOF; integers[2] = 2; integers[3] = 1; - DUMP_INT_ARRAY("int* integers (before secure erasure)", integers, COUNT); + DUMP_INT_ARRAY("int* integers (before secure erasure)", integers, COUNT, + "%d"); printf("Secure erasure is " #if NO_SECURE_ERASE_WARRANTY "not guaranteed!" @@ -51,7 +52,8 @@ int main(void) { ); secure_erase(integers, COUNT * sizeof(int)); - DUMP_INT_ARRAY("int* integers (after secure erasure)", integers, COUNT); + DUMP_INT_ARRAY("int* integers (after secure erasure)", integers, COUNT, + "%d"); safe_free(integers); PRINT_POINTER("int* integers (after freeing)", integers);