Skip to content

Commit 98d1813

Browse files
committed
Drop unnecessary casts in getElfType()
Also declare the function static and warn if return value not used.
1 parent c00676a commit 98d1813

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/patchelf.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ struct ElfType
212212
};
213213

214214

215-
ElfType getElfType(const FileContents & fileContents)
215+
[[nodiscard]] static ElfType getElfType(const FileContents & fileContents)
216216
{
217217
/* Check the ELF header for basic validity. */
218-
if (fileContents->size() < static_cast<off_t>(sizeof(Elf32_Ehdr)))
218+
if (fileContents->size() < sizeof(Elf32_Ehdr))
219219
error("missing ELF header");
220220

221221
auto contents = fileContents->data();

0 commit comments

Comments
 (0)