diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-05-03 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-05-03 08:00:00 +0000 |
commit | 66e28aa5d2e3f573e46e405202303ee638b04c29 (patch) | |
tree | 16da6c774a854cb4574a18b72c2cea4568fa494c /src/nlattr.c | |
parent | 5f859dbb100f5bd61b3f2bc8af0644d4eee034e1 (diff) | |
download | strace-66e28aa5d2e3f573e46e405202303ee638b04c29.tar.gz |
nlattr: use print_fields.h helpers
* src/netlink.c (decode_nlattr): Use tprint_array_begin,
tprint_array_next, and tprint_array_end.
(decode_nla_be16, decode_nla_be64): Use tprints_arg_begin, PRINT_VAL_U,
and tprint_arg_end.
Diffstat (limited to 'src/nlattr.c')
-rw-r--r-- | src/nlattr.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/nlattr.c b/src/nlattr.c index 933d88664..fee67698a 100644 --- a/src/nlattr.c +++ b/src/nlattr.c @@ -142,7 +142,7 @@ decode_nlattr(struct tcb *const tcp, } if (!is_array && next_addr) { - tprints("["); + tprint_array_begin(); is_array = true; } @@ -152,13 +152,13 @@ decode_nlattr(struct tcb *const tcp, if (!next_addr) break; - tprints(", "); + tprint_array_next(); addr = next_addr; len = next_len; } if (is_array) { - tprints("]"); + tprint_array_end(); } } @@ -431,8 +431,11 @@ decode_nla_be16(struct tcb *const tcp, if (len < sizeof(num)) return false; - else if (!umove_or_printaddr(tcp, addr, &num)) - tprintf("htons(%u)", ntohs(num)); + else if (!umove_or_printaddr(tcp, addr, &num)) { + tprints_arg_begin("htons"); + PRINT_VAL_U(ntohs(num)); + tprint_arg_end(); + } return true; } @@ -448,8 +451,11 @@ decode_nla_be64(struct tcb *const tcp, if (len < sizeof(num)) return false; - else if (!umove_or_printaddr(tcp, addr, &num)) - tprintf("htobe64(%" PRIu64 ")", be64toh(num)); + else if (!umove_or_printaddr(tcp, addr, &num)) { + tprints_arg_begin("htobe64"); + PRINT_VAL_U(be64toh(num)); + tprint_arg_end(); + } return true; #else |