On Thu, Nov 07, 2024 at 07:43:27PM +0100, Stefano Brivio wrote: > cppcheck 2.14.2 on Alpine reports: > > dhcpv6.c:431:32: style: Variable 'client_id' can be declared as pointer to const [constVariablePointer] > struct opt_hdr *ia, *bad_ia, *client_id; > ^ > > It's not only 'client_id': we can declare 'ia' as const pointer too. > > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > dhcpv6.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/dhcpv6.c b/dhcpv6.c > index f2e7307..0523bba 100644 > --- a/dhcpv6.c > +++ b/dhcpv6.c > @@ -423,11 +423,11 @@ search: > int dhcpv6(struct ctx *c, const struct pool *p, > const struct in6_addr *saddr, const struct in6_addr *daddr) > { > - struct opt_hdr *ia, *bad_ia, *client_id; > - const struct opt_hdr *server_id; > + const struct opt_hdr *client_id, *server_id, *ia; > const struct in6_addr *src; > const struct msg_hdr *mh; > const struct udphdr *uh; > + struct opt_hdr *bad_ia; > size_t mlen, n; > > uh = packet_get(p, 0, 0, sizeof(*uh), &mlen); -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson