From: Timm Bäder Date: Wed, 17 Feb 2021 08:45:08 +0000 (+0100) Subject: elfcompress: Pull get_section() into file scope X-Git-Tag: elfutils-0.184~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71b7401496f760a4f748e8d288331b64e2263d00;p=thirdparty%2Felfutils.git elfcompress: Pull get_section() into file scope Get rid of a nested function this way. Signed-off-by: Timm Bäder --- diff --git a/src/ChangeLog b/src/ChangeLog index 0740807c3..d810cf934 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2021-02-17 Timm Bäder + + * 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 * elfcompress.c (process_file): Move set_section function... diff --git a/src/elfcompress.c b/src/elfcompress.c index 65a922a72..2dc74a0c1 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);