From: Emil Velikov Date: Wed, 7 May 2025 19:00:12 +0000 (+0100) Subject: libkmod: kmod_file_get_contents() returns constant data X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e9ac8571117705561ecec36b01f1e18fb04c999;p=thirdparty%2Fkmod.git libkmod: kmod_file_get_contents() returns constant data The function returns what is considered constant data and all the callers handle it as such. Add the declaration to make things obvious. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/346 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c index 89f74641..0eeb00a4 100644 --- a/libkmod/libkmod-file.c +++ b/libkmod/libkmod-file.c @@ -135,7 +135,7 @@ int kmod_file_load_contents(struct kmod_file *file) return file->load(file); } -void *kmod_file_get_contents(const struct kmod_file *file) +const void *kmod_file_get_contents(const struct kmod_file *file) { return file->memory; } diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h index 3761ea18..be26e0d2 100644 --- a/libkmod/libkmod-internal.h +++ b/libkmod/libkmod-internal.h @@ -138,7 +138,7 @@ _nonnull_all_ bool kmod_module_is_builtin(struct kmod_module *mod); _must_check_ _nonnull_all_ struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename); _nonnull_all_ struct kmod_elf *kmod_file_get_elf(struct kmod_file *file); _nonnull_all_ int kmod_file_load_contents(struct kmod_file *file); -_must_check_ _nonnull_all_ void *kmod_file_get_contents(const struct kmod_file *file); +_must_check_ _nonnull_all_ const void *kmod_file_get_contents(const struct kmod_file *file); _must_check_ _nonnull_all_ off_t kmod_file_get_size(const struct kmod_file *file); _must_check_ _nonnull_all_ enum kmod_file_compression_type kmod_file_get_compression(const struct kmod_file *file); _must_check_ _nonnull_all_ int kmod_file_get_fd(const struct kmod_file *file);