]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Inline elf_get_strings_section
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 20 Oct 2024 10:23:42 +0000 (12:23 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 22 Oct 2024 17:02:56 +0000 (12:02 -0500)
Its only caller can do the processing directly (kmod_elf_new).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/196
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c

index ade39c29112e186f3ed3a59f30a8ddb2458506e4..2fb215d7fbff243dc2c906a8d0d11c7ad2cf09ba 100644 (file)
@@ -246,12 +246,6 @@ fail:
        return -EINVAL;
 }
 
-static const char *elf_get_strings_section(const struct kmod_elf *elf, uint64_t *size)
-{
-       *size = elf->header.strings.size;
-       return elf_get_mem(elf, elf->header.strings.offset);
-}
-
 struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
 {
        struct kmod_elf *elf;
@@ -333,8 +327,8 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
                ELFDBG(elf, "could not get strings section\n");
                goto invalid;
        } else {
-               uint64_t slen;
-               const char *s = elf_get_strings_section(elf, &slen);
+               uint64_t slen = elf->header.strings.size;
+               const char *s = elf_get_mem(elf, elf->header.strings.offset);
                if (slen == 0 || s[slen - 1] != '\0') {
                        ELFDBG(elf, "strings section does not end with \\0\n");
                        goto invalid;