Skip to contentSkip to conversation

print_fields.h: add macro to print hexadecimal array field

PATCH New Eugene Syromyatnikov 1 participant 1 message Jan 18, 2018 s390

lore
Share & tools
lore
#0 lore raw

PATCH 3/12 print_fields.h: add macro to print hexadecimal array field

* print_fields.h (PRINT_FIELD_HEX_ARRAY): New macro, prints target array with QUOTE_FORCE_HEX.

---
 print_fields.h | 9 +++++++++
 1 file changed, 9 insertions(+)
print_fields.h +9 -0
index 0af087a..b2c6a30 100644
@@ -107,6 +107,15 @@
 				     sizeof((where_).field_));		\
 	} while (0)
 
+#define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_)			\
+	do {								\
+		STRACE_PRINTF("%s%s=", (prefix_), #field_);		\
+		print_quoted_string((const char *)(where_).field_,	\
+				     sizeof((where_).field_) +		\
+					    MUST_BE_ARRAY((where_).field_), \
+				    QUOTE_FORCE_HEX); \
+	} while (0)
+
 #define PRINT_FIELD_INET_ADDR(prefix_, where_, field_, af_)		\
 	do {								\
 		STRACE_PRINTF(prefix_);					\
Signature · 1 line
2.1.4