Skip to content

Commit 0e9ac85

Browse files
evelikovlucasdemarchi
authored andcommitted
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 <[email protected]> Link: #346 Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 1b110b9 commit 0e9ac85

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libkmod/libkmod-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int kmod_file_load_contents(struct kmod_file *file)
135135
return file->load(file);
136136
}
137137

138-
void *kmod_file_get_contents(const struct kmod_file *file)
138+
const void *kmod_file_get_contents(const struct kmod_file *file)
139139
{
140140
return file->memory;
141141
}

libkmod/libkmod-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ _nonnull_all_ bool kmod_module_is_builtin(struct kmod_module *mod);
138138
_must_check_ _nonnull_all_ struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename);
139139
_nonnull_all_ struct kmod_elf *kmod_file_get_elf(struct kmod_file *file);
140140
_nonnull_all_ int kmod_file_load_contents(struct kmod_file *file);
141-
_must_check_ _nonnull_all_ void *kmod_file_get_contents(const struct kmod_file *file);
141+
_must_check_ _nonnull_all_ const void *kmod_file_get_contents(const struct kmod_file *file);
142142
_must_check_ _nonnull_all_ off_t kmod_file_get_size(const struct kmod_file *file);
143143
_must_check_ _nonnull_all_ enum kmod_file_compression_type kmod_file_get_compression(const struct kmod_file *file);
144144
_must_check_ _nonnull_all_ int kmod_file_get_fd(const struct kmod_file *file);

0 commit comments

Comments
 (0)