From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id BD33E386EC78 for ; Mon, 23 Nov 2020 12:27:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BD33E386EC78 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-537-HQ4-Q5FPPg-2nYkdpDAHNQ-1; Mon, 23 Nov 2020 07:27:40 -0500 X-MC-Unique: HQ4-Q5FPPg-2nYkdpDAHNQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD0C85F9C0 for ; Mon, 23 Nov 2020 12:27:39 +0000 (UTC) Received: from hostfoo.redhat.com (ovpn-112-164.ams2.redhat.com [10.36.112.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id D571F1F462 for ; Mon, 23 Nov 2020 12:27:38 +0000 (UTC) From: tbaeder@redhat.com To: elfutils-devel@sourceware.org Subject: [PATCH 11/12] segment_report_module: Inline consider_dyn() into only caller Date: Mon, 23 Nov 2020 13:27:11 +0100 Message-Id: <20201123122712.3799676-12-tbaeder@redhat.com> In-Reply-To: <20201123122712.3799676-1-tbaeder@redhat.com> References: <20201123122712.3799676-1-tbaeder@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2020 12:27:43 -0000 From: Timm Bäder Signed-off-by: Timm Bäder --- libdwfl/dwfl_segment_report_module.c | 40 +++++++++------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 8613ce21..046d5381 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -770,33 +770,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; @@ -834,7 +807,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; } } -- 2.26.2