From: Dmitry V. Levin Date: Wed, 28 Jun 2017 01:40:00 +0000 (+0000) Subject: nlattr: add const qualifiers to auto variables and function arguments X-Git-Tag: v4.18~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91b87e65ff724fd180a673091c402397f0ca4283;p=strace nlattr: add const qualifiers to auto variables and function arguments This change does not affect the code generated by the compiler, the purpose of these "const" qualifiers is to highlight the intent. * nlattr.c (decode_nlattr_with_data, decode_nla_str, decode_nla_strn, decode_nla_##name): Add const qualifier to tcp, addr, and len arguments. --- diff --git a/nlattr.c b/nlattr.c index 3a3a0d79..ef3d7622 100644 --- a/nlattr.c +++ b/nlattr.c @@ -61,10 +61,10 @@ print_nlattr(const struct nlattr *const nla, } static void -decode_nlattr_with_data(struct tcb *tcp, +decode_nlattr_with_data(struct tcb *const tcp, const struct nlattr *const nla, - kernel_ulong_t addr, - kernel_ulong_t len, + const kernel_ulong_t addr, + const kernel_ulong_t len, const struct xlat *const table, const char *const dflt, const nla_decoder_t *const decoders, @@ -144,8 +144,10 @@ decode_nlattr(struct tcb *const tcp, } bool -decode_nla_str(struct tcb *tcp, kernel_ulong_t addr, - kernel_ulong_t len, const void *const opaque_data) +decode_nla_str(struct tcb *const tcp, + const kernel_ulong_t addr, + const kernel_ulong_t len, + const void *const opaque_data) { printstr_ex(tcp, addr, len, QUOTE_0_TERMINATED); @@ -153,26 +155,30 @@ decode_nla_str(struct tcb *tcp, kernel_ulong_t addr, } bool -decode_nla_strn(struct tcb *tcp, kernel_ulong_t addr, - kernel_ulong_t len, const void *const opaque_data) +decode_nla_strn(struct tcb *const tcp, + const kernel_ulong_t addr, + const kernel_ulong_t len, + const void *const opaque_data) { printstrn(tcp, addr, len); return true; } -#define DECODE_NLA_INTEGER(name, type, fmt) \ -bool \ -decode_nla_ ## name(struct tcb *tcp, kernel_ulong_t addr, \ - kernel_ulong_t len, const void *const opaque_data) \ -{ \ - type num; \ - \ - if (len < sizeof(num)) \ - return false; \ - if (!umove_or_printaddr(tcp, addr, &num)) \ - tprintf(fmt, num); \ - return true; \ +#define DECODE_NLA_INTEGER(name, type, fmt) \ +bool \ +decode_nla_ ## name(struct tcb *const tcp, \ + const kernel_ulong_t addr, \ + const kernel_ulong_t len, \ + const void *const opaque_data) \ +{ \ + type num; \ + \ + if (len < sizeof(num)) \ + return false; \ + if (!umove_or_printaddr(tcp, addr, &num)) \ + tprintf(fmt, num); \ + return true; \ } DECODE_NLA_INTEGER(u8, uint8_t, "%" PRIu8)