From 6471c7d01b0aad9d144448290557fcd783562228 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 29 Sep 2023 15:50:19 +1000 Subject: cppcheck: Make many pointers const Newer versions of cppcheck (as of 2.12.0, at least) added a warning for pointers which could be declared to point at const data, but aren't. Based on that, make many pointers throughout the codebase const. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- pasta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pasta.c') diff --git a/pasta.c b/pasta.c index 9bc26d5..5fd44fe 100644 --- a/pasta.c +++ b/pasta.c @@ -362,7 +362,7 @@ void pasta_ns_conf(struct ctx *c) * * Return: inotify file descriptor, -1 on failure or if not needed/applicable */ -int pasta_netns_quit_init(struct ctx *c) +int pasta_netns_quit_init(const struct ctx *c) { int flags = O_NONBLOCK | O_CLOEXEC; union epoll_ref ref = { .type = EPOLL_TYPE_NSQUIT }; @@ -399,7 +399,7 @@ int pasta_netns_quit_init(struct ctx *c) void pasta_netns_quit_handler(struct ctx *c, int inotify_fd) { char buf[sizeof(struct inotify_event) + NAME_MAX + 1]; - struct inotify_event *in_ev = (struct inotify_event *)buf; + const struct inotify_event *in_ev = (struct inotify_event *)buf; if (read(inotify_fd, buf, sizeof(buf)) < (ssize_t)sizeof(*in_ev)) return; -- cgit v1.2.3