]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Unify READV usages
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 16 Oct 2024 14:46:00 +0000 (16:46 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 18 Oct 2024 19:00:27 +0000 (14:00 -0500)
Do not assign variables which are not even used, but merely exist for
the READV macro to work.

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/187
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
.clang-format
libkmod/libkmod-elf.c
shared/macro.h

index ba51900faad5011c9bdfd6b2f5f94a228a3408d8..06fd6f8a6300a7cc3eec7b85908684881998cd2c 100644 (file)
@@ -86,7 +86,6 @@ AttributeMacros:
   - _nonnull_
   - _nonnull_all_
   - _printf_format_
-  - _unused_
   - noreturn
 
 IncludeBlocks: Preserve
index 63f5e88215ad98e547bee3fc3b9eb26e2a3d6154..c90b66113fc87b3e18db15113dde0eb9008bbaec 100644 (file)
@@ -223,12 +223,12 @@ static inline int elf_get_section_info(const struct kmod_elf *elf, uint16_t idx,
        elf_get_uint(elf, off + offsetof(typeof(*hdr), field), sizeof(hdr->field))
 
        if (elf->class & KMOD_ELF_32) {
-               const Elf32_Shdr *hdr _unused_ = (const Elf32_Shdr *)p;
+               Elf32_Shdr *hdr;
                *size = READV(sh_size);
                *offset = READV(sh_offset);
                *nameoff = READV(sh_name);
        } else {
-               const Elf64_Shdr *hdr _unused_ = (const Elf64_Shdr *)p;
+               Elf64_Shdr *hdr;
                *size = READV(sh_size);
                *offset = READV(sh_offset);
                *nameoff = READV(sh_name);
@@ -296,11 +296,11 @@ struct kmod_elf *kmod_elf_new(const void *memory, off_t size)
        elf->header.strings.section = READV(e_shstrndx);     \
        elf->header.machine = READV(e_machine)
        if (elf->class & KMOD_ELF_32) {
-               const Elf32_Ehdr *hdr _unused_ = elf_get_mem(elf, 0);
+               Elf32_Ehdr *hdr;
                LOAD_HEADER;
                shdr_size = sizeof(Elf32_Shdr);
        } else {
-               const Elf64_Ehdr *hdr _unused_ = elf_get_mem(elf, 0);
+               Elf64_Ehdr *hdr;
                LOAD_HEADER;
                shdr_size = sizeof(Elf64_Shdr);
        }
index b7e91c74ef2c6351b1a5416e4390ed05a7d619db..62876b050b4406d4c6a93ecbc9cac1a911389737 100644 (file)
@@ -42,7 +42,6 @@
 
 #define _must_check_ __attribute__((warn_unused_result))
 #define _printf_format_(a, b) __attribute__((format(printf, a, b)))
-#define _unused_ __attribute__((unused))
 #define _always_inline_ __inline__ __attribute__((always_inline))
 #define _cleanup_(x) __attribute__((cleanup(x)))
 #define _nonnull_(...) __attribute__((nonnull(__VA_ARGS__)))