Skip to content

Commit ddd28fe

Browse files
committed
clang-tidy: do not use else after return
Found with readability-else-after-return Signed-off-by: Rosen Penev <[email protected]>
1 parent cedf284 commit ddd28fe

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/patchelf.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ __attribute__((noreturn)) static void error(const std::string & msg)
299299
{
300300
if (errno)
301301
throw SysError(msg);
302-
else
303-
throw std::runtime_error(msg);
302+
throw std::runtime_error(msg);
304303
}
305304

306305
static void growFile(const FileContents & contents, size_t newSize)
@@ -895,11 +894,10 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsExecutable()
895894
startAddr = rdi(shdr.sh_addr);
896895
lastReplaced = i - 1;
897896
break;
898-
} else {
899-
if (replacedSections.find(sectionName) == replacedSections.end()) {
900-
debug("replacing section '%s' which is in the way\n", sectionName.c_str());
901-
replaceSection(sectionName, rdi(shdr.sh_size));
902-
}
897+
}
898+
if (replacedSections.find(sectionName) == replacedSections.end()) {
899+
debug("replacing section '%s' which is in the way\n", sectionName.c_str());
900+
replaceSection(sectionName, rdi(shdr.sh_size));
903901
}
904902
prevSection = sectionName;
905903
}

0 commit comments

Comments
 (0)