segment_report_module: Inline consider_dyn() into only caller
authorTimm Bäder <tbaeder@redhat.com>
Mon, 23 Nov 2020 12:27:11 +0000 (13:27 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 25 Nov 2020 15:39:01 +0000 (16:39 +0100)
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_segment_report_module.c

index 0c66bed..88f0714 100644 (file)
@@ -1,5 +1,10 @@
 2020-11-23  Timm Bäder  <tbaeder@redhat.com>
 
+       * segment_report_module.c (dwfl_segment_report_module): Remove
+       consider_dyn, do checks inline.
+
+2020-11-23  Timm Bäder  <tbaeder@redhat.com>
+
        * segment_report_module.c (dwfl_segment_report_module): Do one
        loop check for d32/d64 arrays.
 
index 2fb62bd..a1051e1 100644 (file)
@@ -740,33 +740,6 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
   GElf_Addr dynstr_vaddr = 0;
   GElf_Xword dynstrsz = 0;
   bool execlike = false;
-  inline bool consider_dyn (GElf_Sxword tag, GElf_Xword val)
-  {
-    switch (tag)
-      {
-      default:
-       return false;
-
-      case DT_DEBUG:
-       execlike = true;
-       break;
-
-      case DT_SONAME:
-       soname_stroff = val;
-       break;
-
-      case DT_STRTAB:
-       dynstr_vaddr = val;
-       break;
-
-      case DT_STRSZ:
-       dynstrsz = val;
-       break;
-      }
-
-    return soname_stroff != 0 && dynstr_vaddr != 0 && dynstrsz != 0;
-  }
-
   const size_t dyn_entsize = (ei_class == ELFCLASS32
                              ? sizeof (Elf32_Dyn) : sizeof (Elf64_Dyn));
   void *dyn_data = NULL;
@@ -804,7 +777,18 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
               GElf_Sxword tag = is32 ? d32[i].d_tag : d64[i].d_tag;
               GElf_Xword val = is32 ? d32[i].d_un.d_val : d64[i].d_un.d_val;
 
-              if (consider_dyn (tag, val))
+              if (tag == DT_DEBUG)
+                execlike = true;
+              else if (tag == DT_SONAME)
+                soname_stroff = val;
+              else if (tag == DT_STRTAB)
+                dynstr_vaddr = val;
+              else if (tag == DT_STRSZ)
+                dynstrsz = val;
+              else
+                continue;
+
+              if (soname_stroff != 0 && dynstr_vaddr != 0 && dynstrsz != 0)
                 break;
             }
         }