diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2018-05-07 08:15:19 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-05-09 22:01:45 +0000 |
commit | afc49df0b09e46eb0bb25c657b5471f50e90815a (patch) | |
tree | a87a5213f631bbb099a6a9dbde4bef7184e725e5 | |
parent | 3f59353ab3d70a8e57e873732dad7378b1aee0bf (diff) | |
download | strace-afc49df0b09e46eb0bb25c657b5471f50e90815a.tar.gz |
Use MIN where appropriate
* netlink.c (decode_nlmsghdr_with_payload): Use MIN.
* netlink_packet_diag.c (print_packet_diag_mclist): Likewise.
* nlattr.c (decode_nlattr_with_data): Likewise.
* rtnl_route.c (decode_rta_multipath): Likewise.
-rw-r--r-- | netlink.c | 3 | ||||
-rw-r--r-- | netlink_packet_diag.c | 3 | ||||
-rw-r--r-- | nlattr.c | 2 | ||||
-rw-r--r-- | rtnl_route.c | 3 |
4 files changed, 4 insertions, 7 deletions
@@ -607,8 +607,7 @@ decode_nlmsghdr_with_payload(struct tcb *const tcp, const kernel_ulong_t addr, const kernel_ulong_t len) { - const unsigned int nlmsg_len = - nlmsghdr->nlmsg_len > len ? len : nlmsghdr->nlmsg_len; + const unsigned int nlmsg_len = MIN(nlmsghdr->nlmsg_len, len); if (nlmsg_len > NLMSG_HDRLEN) tprints("{"); diff --git a/netlink_packet_diag.c b/netlink_packet_diag.c index db688a9f9..877ebc43e 100644 --- a/netlink_packet_diag.c +++ b/netlink_packet_diag.c @@ -96,8 +96,7 @@ print_packet_diag_mclist(struct tcb *const tcp, void *const elem_buf, const size_t elem_size, void *const opaque_data) { struct packet_diag_mclist *dml = elem_buf; - uint16_t alen = dml->pdmc_alen > sizeof(dml->pdmc_addr) ? - sizeof(dml->pdmc_addr) : dml->pdmc_alen; + uint16_t alen = MIN(dml->pdmc_alen, sizeof(dml->pdmc_addr)); PRINT_FIELD_IFINDEX("{", *dml, pdmc_index); PRINT_FIELD_U(", ", *dml, pdmc_count); @@ -83,7 +83,7 @@ decode_nlattr_with_data(struct tcb *const tcp, const unsigned int size, const void *const opaque_data) { - const unsigned int nla_len = nla->nla_len > len ? len : nla->nla_len; + const unsigned int nla_len = MIN(nla->nla_len, len); if (nla_len > NLA_HDRLEN) tprints("{"); diff --git a/rtnl_route.c b/rtnl_route.c index 93205c9b1..1cc93392a 100644 --- a/rtnl_route.c +++ b/rtnl_route.c @@ -255,8 +255,7 @@ decode_rta_multipath(struct tcb *const tcp, PRINT_FIELD_IFINDEX(", ", nh, rtnh_ifindex); tprints("}"); - const unsigned short rtnh_len = - len < nh.rtnh_len ? len : nh.rtnh_len; + const unsigned short rtnh_len = MIN(len, nh.rtnh_len); const size_t offset = RTNH_ALIGN(sizeof(nh)); if (rtnh_len > offset) { tprints(", "); |