]> granicus.if.org Git - strace/commitdiff
print_fields.h: introduce PRINT_FIELD_CSTRING_SZ macro
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 25 Mar 2018 12:11:09 +0000 (14:11 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Apr 2018 16:33:19 +0000 (16:33 +0000)
A variant of PRINT_FIELD_CSTRING with an ability to pass string size
explicitly.

* print_fields.h (PRINT_FIELD_CSTRING_SZ): New macro.

print_fields.h

index fff746388e966b2d43c133f66e6b15c42b717dca..e456f4c2a63f6084af8f62443c8e1064c27f2314 100644 (file)
                                        MUST_BE_ARRAY((where_).field_)); \
        } while (0)
 
+#define PRINT_FIELD_CSTRING_SZ(prefix_, where_, field_, size_)         \
+       do {                                                            \
+               STRACE_PRINTF("%s%s=", (prefix_), #field_);             \
+               print_quoted_cstring((const char *) (where_).field_,    \
+                                    (size_));                          \
+       } while (0)
+
 #define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_)                 \
        do {                                                            \
                STRACE_PRINTF("%s%s=", (prefix_), #field_);             \