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 --- util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 57a05fb..60d6872 100644 --- a/util.h +++ b/util.h @@ -218,7 +218,7 @@ void bitmap_clear(uint8_t *map, int bit); int bitmap_isset(const uint8_t *map, int bit); char *line_read(char *buf, size_t len, int fd); void procfs_scan_listen(struct ctx *c, uint8_t proto, int ip_version, int ns, - uint8_t *map, uint8_t *exclude); + uint8_t *map, const uint8_t *exclude); void ns_enter(const struct ctx *c); bool ns_is_init(void); void write_pidfile(int fd, pid_t pid); @@ -235,7 +235,7 @@ int write_file(const char *path, const char *buf); * clang-tidy suppressions, because the warning doesn't show on the syscall * itself but later when we access the supposedly uninitialised field. */ -static inline void sa_init(struct sockaddr *sa, socklen_t *sl) +static inline void sa_init(struct sockaddr *sa, const socklen_t *sl) { #ifdef CLANG_TIDY_58992 if (sa) -- cgit v1.2.3