]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: kmod_file_get_contents() returns constant data
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 7 May 2025 19:00:12 +0000 (20:00 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 20 May 2025 02:51:44 +0000 (21:51 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/346
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-file.c
libkmod/libkmod-internal.h

index 89f746419419246bdde3fe00298d594690d227f0..0eeb00a42c2ed698e7e982634bb364d66c07c7ab 100644 (file)
@@ -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;
 }
index 3761ea18458dbd440960f81733d962621cbc0acf..be26e0d293742761b519ec214ec880ae1397dd04 100644 (file)
@@ -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);