From a179ca6707b29cfc01371fb5636b2f49d263ab83 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 15 Jan 2024 17:39:43 +1100 Subject: 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 Signed-off-by: Stefano Brivio --- tcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index 9515649..5b37662 100644 --- a/tcp.c +++ b/tcp.c @@ -2296,7 +2296,7 @@ static int tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn, for (i = idx, iov_i = 0; i < (int)p->count; i++) { uint32_t seq, seq_offset, ack_seq; - struct tcphdr *th; + const struct tcphdr *th; char *data; size_t off; @@ -2517,10 +2517,10 @@ int tcp_tap_handler(struct ctx *c, uint8_t pif, int af, const struct pool *p, int idx, const struct timespec *now) { struct tcp_tap_conn *conn; + const struct tcphdr *th; size_t optlen, len; - struct tcphdr *th; + const char *opts; int ack_due = 0; - char *opts; int count; (void)pif; @@ -3038,7 +3038,7 @@ void tcp_ns_sock_init(const struct ctx *c, in_port_t port) */ static int tcp_ns_socks_init(void *arg) { - struct ctx *c = (struct ctx *)arg; + const struct ctx *c = (const struct ctx *)arg; unsigned port; ns_enter(c); -- cgit v1.2.3