From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32011 invoked by alias); 7 May 2013 12:25:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31929 invoked by uid 89); 7 May 2013 12:25:43 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_THREADED,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 12:25:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CA6CC2EDB6; Tue, 7 May 2013 08:25:39 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kZaFf2Z4Mcep; Tue, 7 May 2013 08:25:39 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 830C52EDB3; Tue, 7 May 2013 08:25:39 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4233) id 7D1693FF0B; Tue, 7 May 2013 08:25:39 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pedro Alves , Joel Brobecker Subject: [RFA 3/3] Avoid duplicating text in sol-thread.c:info_cb Date: Tue, 07 May 2013 12:25:00 -0000 Message-Id: <1367929532-4849-4-git-send-email-brobecker@adacore.com> In-Reply-To: <518284AF.5090802@redhat.com> References: <518284AF.5090802@redhat.com> X-SW-Source: 2013-05/txt/msg00200.txt.bz2 This is a minor cleanup that helps avoiding duplicating the output of a command when handling alternative situations. gdb/ChangeLog: * sol-thread.c (info_cb): Factorize the code a little. Same as patch #2, I could probably self-approve, but there could be merit in the current approach if the output was thought to one day become different depending on some (future) factors... --- gdb/sol-thread.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index fb89723..a17a55b 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1176,12 +1176,10 @@ info_cb (const td_thrhandle_t *th, void *s) const struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (ti.ti_startfunc); - if (msym.minsym) - printf_filtered (" startfunc=%s", - SYMBOL_PRINT_NAME (msym.minsym)); - else - printf_filtered (" startfunc=%s", - paddress (target_gdbarch (), ti.ti_startfunc)); + printf_filtered (" startfunc=%s", + msym.minsym + ? SYMBOL_PRINT_NAME (msym.minsym) + : paddress (target_gdbarch (), ti.ti_startfunc)); } /* If thread is asleep, print function that went to sleep. */ @@ -1190,12 +1188,10 @@ info_cb (const td_thrhandle_t *th, void *s) const struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (ti.ti_pc); - if (msym.minsym) - printf_filtered (" sleepfunc=%s", - SYMBOL_PRINT_NAME (msym.minsym)); - else - printf_filtered (" sleepfunc=%s", - paddress (target_gdbarch (), ti.ti_pc)); + printf_filtered (" sleepfunc=%s", + msym.minsym + ? SYMBOL_PRINT_NAME (msym.minsym) + : paddress (target_gdbarch (), ti.ti_pc)); } printf_filtered ("\n"); -- 1.7.0.4