diff options
author | Timm Bäder <tbaeder@redhat.com> | 2021-02-17 09:45:08 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2021-03-01 23:01:13 +0100 |
commit | 71b7401496f760a4f748e8d288331b64e2263d00 (patch) | |
tree | 7c26b332aa023b30cc29b31f32e81d7129caddc5 | |
parent | c9ccf7e3f0a98afea1ca54857f6d2042611853b9 (diff) | |
download | elfutils-71b7401496f760a4f748e8d288331b64e2263d00.tar.gz |
elfcompress: Pull get_section() into file scope
Get rid of a nested function this way.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/elfcompress.c | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0740807c..d810cf93 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2021-02-17 Timm Bäder <tbaeder@redhat.com> + * elfcompress.c (process_file): Move get_section function... + (get_section): ...to top-level static function taking an + sections array. + +2021-02-17 Timm Bäder <tbaeder@redhat.com> + * elfcompress.c (process_file): Move set_section function... (set_section): ...to top-level static function taking a section array. diff --git a/src/elfcompress.c b/src/elfcompress.c index 65a922a7..2dc74a0c 100644 --- a/src/elfcompress.c +++ b/src/elfcompress.c @@ -250,6 +250,12 @@ set_section (unsigned int *sections, size_t ndx) sections[ndx / WORD_BITS] |= (1U << (ndx % WORD_BITS)); } +static bool +get_section (unsigned int *sections, size_t ndx) +{ + return (sections[ndx / WORD_BITS] & (1U << (ndx % WORD_BITS))) != 0; +} + static int process_file (const char *fname) { @@ -283,11 +289,6 @@ process_file (const char *fname) /* How many sections are we talking about? */ size_t shnum = 0; - bool get_section (size_t ndx) - { - return (sections[ndx / WORD_BITS] & (1U << (ndx % WORD_BITS))) != 0; - } - /* How many sections are we going to change? */ size_t get_sections (void) { @@ -689,7 +690,7 @@ process_file (const char *fname) /* (de)compress if section matched. */ char *sname = NULL; char *newname = NULL; - if (get_section (ndx)) + if (get_section (sections, ndx)) { GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); |