From 82c41f15fc8a7808bed2f709cee53741010ac02c Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 4 Dec 2020 16:12:33 +1030 Subject: [PATCH] print field name now it's available --- ez-blob-print.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ez-blob-print.c b/ez-blob-print.c index 4f61bc3..4757453 100644 --- a/ez-blob-print.c +++ b/ez-blob-print.c @@ -39,8 +39,8 @@ void ez_blob_print(const ez_blob_desc *d, const void *a, int depth) { for (int i=0;i<=len;i++,d++) { const void *u = a + d->bd_offset; - printf("%s [type=$%04x, offset=$%04x]", x, d->bd_type, d->bd_offset); - + printf("%s %-20s [type=$%04x, offset=$%04x]", x, d->bd_name, d->bd_type, d->bd_offset); + switch (d->bd_type) { case EZ_BLOB_INT8: printf(" .%d = %02x\n", d->bd_id, *(uint8_t *)u); @@ -60,7 +60,7 @@ void ez_blob_print(const ez_blob_desc *d, const void *a, int depth) { case EZ_BLOB_FLOAT64: printf(" .%d = %f\n", d->bd_id, *(double *)u); break; - + case EZ_BLOB_STRUCT | EZ_BLOB_SINGLEP | EZ_BLOB_ISNULLABLE: case EZ_BLOB_STRUCT | EZ_BLOB_SINGLEP: u = *(void **)u; @@ -88,7 +88,7 @@ void ez_blob_print(const ez_blob_desc *d, const void *a, int depth) { const struct ez_blob *ua = u; unsigned int elsize = 1 << (d->bd_type & EZ_BLOB_SIZE); ez_blob blob = { .eb_size = ua->eb_size * elsize, .eb_data = ua->eb_data }; - + printf(" .%d %p [%zd x %d] = {\n", d->bd_id, ua->eb_data, ua->eb_size, elsize); ez_blob_dump(&blob, x); printf("%s }\n", x); @@ -121,4 +121,3 @@ void ez_blob_print(const ez_blob_desc *d, const void *a, int depth) { } } } - -- 2.39.5