diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-01-15 17:39:43 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-01-16 21:49:27 +0100 |
commit | a179ca6707b29cfc01371fb5636b2f49d263ab83 (patch) | |
tree | a783d015ca015059be6ce1b54e91565ef221c498 /dhcp.c | |
parent | f60c85194b87c6cc182b9868c9e6a6b8ac1af48f (diff) | |
download | passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.gz passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.bz2 passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.lz passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.xz passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.tar.zst passt-a179ca6707b29cfc01371fb5636b2f49d263ab83.zip |
treewide: Make a bunch of pointer variables pointers to const
Sufficiently recent cppcheck (I'm using 2.13.0) seems to have added another
warning for pointer variables which could be pointer to const but aren't.
Use this to make a bunch of variables const pointers where they previously
weren't for no particular reason.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'dhcp.c')
-rw-r--r-- | dhcp.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -275,10 +275,10 @@ static void opt_set_dns_search(const struct ctx *c, size_t max_len) int dhcp(const struct ctx *c, const struct pool *p) { size_t mlen, len, offset = 0, opt_len, opt_off = 0; + const struct ethhdr *eh; + const struct iphdr *iph; + const struct udphdr *uh; struct in_addr mask; - struct ethhdr *eh; - struct iphdr *iph; - struct udphdr *uh; unsigned int i; struct msg *m; @@ -312,7 +312,8 @@ int dhcp(const struct ctx *c, const struct pool *p) offset += offsetof(struct msg, o); while (opt_off + 2 < opt_len) { - uint8_t *olen, *type, *val; + const uint8_t *olen, *val; + uint8_t *type; type = packet_get(p, 0, offset + opt_off, 1, NULL); olen = packet_get(p, 0, offset + opt_off + 1, 1, NULL); |