From: Timm Bäder <tbae...@redhat.com>

Get rid of a nested function this way.

Signed-off-by: Timm Bäder <tbae...@redhat.com>
---
 src/elfcompress.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

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);
-- 
2.26.2

Reply via email to