Skip to content

Commit

Permalink
Simplify ordering code as suggested in PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmillar committed Jan 8, 2018
1 parent a1eab1c commit 71e99c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ class ElfFile
ElfFile * elfFile;
bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y)
{
if (x.p_type == PT_PHDR) {
if (y.p_type == PT_PHDR) return false;
return true;
}
if (y.p_type == PT_PHDR) return false;
return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr);
// A PHDR comes before everything else.
if (y.p_type == PT_PHDR) return false;
if (x.p_type == PT_PHDR) return true;

// Sort non-PHDRs by address.
return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr);
}
};

Expand Down

0 comments on commit 71e99c5

Please sign in to comment.