From: Tobias Stoeckmann Date: Wed, 16 Oct 2024 14:46:00 +0000 (+0200) Subject: libkmod: Unify READV usages X-Git-Tag: v34~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39e6f0e23732668563dc937a20ff7c0ee0ff59f6;p=thirdparty%2Fkmod.git libkmod: Unify READV usages Do not assign variables which are not even used, but merely exist for the READV macro to work. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/187 Signed-off-by: Lucas De Marchi --- diff --git a/.clang-format b/.clang-format index ba51900f..06fd6f8a 100644 --- a/.clang-format +++ b/.clang-format @@ -86,7 +86,6 @@ AttributeMacros: - _nonnull_ - _nonnull_all_ - _printf_format_ - - _unused_ - noreturn IncludeBlocks: Preserve diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 63f5e882..c90b6611 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -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); } diff --git a/shared/macro.h b/shared/macro.h index b7e91c74..62876b05 100644 --- a/shared/macro.h +++ b/shared/macro.h @@ -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__)))