diff options
author | Timm Bäder <tbaeder@redhat.com> | 2021-02-17 09:43:45 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2021-03-01 17:47:20 +0100 |
commit | 2daab4e7661eee6fe8701800a8e54d2448471cbd (patch) | |
tree | cbc2b0dca0b397e6fb5407e428389bc197f7ca56 /src/unstrip.c | |
parent | ec5d1a47e3b9e73a849ed40f94e9ec8017b75b72 (diff) | |
download | elfutils-2daab4e7661eee6fe8701800a8e54d2448471cbd.tar.gz |
unstrip: Pull check_match() into file scope
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
Diffstat (limited to 'src/unstrip.c')
-rw-r--r-- | src/unstrip.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/unstrip.c b/src/unstrip.c index 6e874c3a..72fabac8 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -1065,6 +1065,20 @@ get_group_sig (Elf *elf, GElf_Shdr *shdr) return sig; } +static inline bool +check_match (bool match, Elf_Scn *scn, const char *name) +{ + if (!match) + { + error (0, 0, _("cannot find matching section for [%zu] '%s'"), + elf_ndxscn (scn), name); + return true; + } + + return false; +} + + /* Fix things up when prelink has moved some allocated sections around and the debuginfo file's section headers no longer match up. This fills in SECTIONS[0..NALLOC-1].outscn or exits. @@ -1200,16 +1214,6 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, } bool fail = false; - inline void check_match (bool match, Elf_Scn *scn, const char *name) - { - if (!match) - { - fail = true; - error (0, 0, _("cannot find matching section for [%zu] '%s'"), - elf_ndxscn (scn), name); - } - } - Elf_Scn *scn = NULL; while ((scn = elf_nextscn (debug, scn)) != NULL) { @@ -1240,7 +1244,7 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, for (size_t i = 0; shdr != NULL && i < nalloc; ++i) if (sections[i].outscn == scn) shdr = NULL; - check_match (shdr == NULL, scn, name); + fail |= check_match (shdr == NULL, scn, name); } if (fail) @@ -1296,7 +1300,7 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, } } - check_match (undo_sec == NULL, scn, name); + fail |= check_match (undo_sec == NULL, scn, name); } free (undo_sections); |