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 DF21C386183F for ; Fri, 8 Jan 2021 08:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DF21C386183F 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-145-brlMSuaQMTqpVdeAJtvtAw-1; Fri, 08 Jan 2021 03:13:35 -0500 X-MC-Unique: brlMSuaQMTqpVdeAJtvtAw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B0C815739 for ; Fri, 8 Jan 2021 08:13:35 +0000 (UTC) Received: from hostfoo.redhat.com (ovpn-112-148.ams2.redhat.com [10.36.112.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35D8762A22 for ; Fri, 8 Jan 2021 08:13:34 +0000 (UTC) From: tbaeder@redhat.com To: elfutils-devel@sourceware.org Subject: [PATCH 1/4] addr2line: Pull show_note() and show_int() in file scope Date: Fri, 8 Jan 2021 09:13:25 +0100 Message-Id: <20210108081328.2202283-2-tbaeder@redhat.com> In-Reply-To: <20210108081328.2202283-1-tbaeder@redhat.com> References: <20210108081328.2202283-1-tbaeder@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.5 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_LOW, 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: Fri, 08 Jan 2021 08:13:39 -0000 From: Timm Bäder Get rid of the nested functions Signed-off-by: Timm Bäder --- src/addr2line.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/addr2line.c b/src/addr2line.c index ea01c1be..34945046 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -598,6 +598,26 @@ get_addr_width (Dwfl_Module *mod) return width; } +static inline void +show_note (int (*get) (Dwarf_Line *, bool *), + Dwarf_Line *info, + const char *note) +{ + bool flag; + if ((*get) (info, &flag) == 0 && flag) + fputs (note, stdout); +} + +static inline void +show_int (int (*get) (Dwarf_Line *, unsigned int *), + Dwarf_Line *info, + const char *name) +{ + unsigned int val; + if ((*get) (info, &val) == 0 && val != 0) + printf (" (%s %u)", name, val); +} + static int handle_address (const char *string, Dwfl *dwfl) { @@ -692,27 +712,12 @@ handle_address (const char *string, Dwfl *dwfl) Dwarf_Line *info = dwfl_dwarf_line (line, &bias); assert (info != NULL); - inline void show (int (*get) (Dwarf_Line *, bool *), - const char *note) - { - bool flag; - if ((*get) (info, &flag) == 0 && flag) - fputs (note, stdout); - } - inline void show_int (int (*get) (Dwarf_Line *, unsigned int *), - const char *name) - { - unsigned int val; - if ((*get) (info, &val) == 0 && val != 0) - printf (" (%s %u)", name, val); - } - - show (&dwarf_linebeginstatement, " (is_stmt)"); - show (&dwarf_lineblock, " (basic_block)"); - show (&dwarf_lineprologueend, " (prologue_end)"); - show (&dwarf_lineepiloguebegin, " (epilogue_begin)"); - show_int (&dwarf_lineisa, "isa"); - show_int (&dwarf_linediscriminator, "discriminator"); + show_note (&dwarf_linebeginstatement, info, " (is_stmt)"); + show_note (&dwarf_lineblock, info, " (basic_block)"); + show_note (&dwarf_lineprologueend, info, " (prologue_end)"); + show_note (&dwarf_lineepiloguebegin, info, " (epilogue_begin)"); + show_int (&dwarf_lineisa, info, "isa"); + show_int (&dwarf_linediscriminator, info, "discriminator"); } putchar ('\n'); } -- 2.26.2