From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21962 invoked by alias); 19 Sep 2012 13:22:20 -0000 Received: (qmail 21941 invoked by uid 22791); 19 Sep 2012 13:22:19 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Sep 2012 13:22:05 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TEKE8-0003SB-RG from Yao_Qi@mentor.com ; Wed, 19 Sep 2012 06:22:04 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 19 Sep 2012 06:22:04 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Wed, 19 Sep 2012 06:22:03 -0700 Message-ID: <5059C6C7.90100@codesourcery.com> Date: Wed, 19 Sep 2012 13:22:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Mohsan Saleem CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] gdb bug 12417 References: <1347974206.13036.YahooMailNeo@web114403.mail.gq1.yahoo.com> <1348052394.61813.YahooMailNeo@web114408.mail.gq1.yahoo.com> In-Reply-To: <1348052394.61813.YahooMailNeo@web114408.mail.gq1.yahoo.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2012-09/txt/msg00390.txt.bz2 On 09/19/2012 06:59 PM, Mohsan Saleem wrote: > --- /root/Desktop/gdb/thread.c 2012-09-03 00:53:02.620254912 -0700 > +++ ./gdb/thread.c 2012-09-03 00:58:04.399469614 -0700 > @@ -243,12 +243,14 @@ > struct thread_info * > add_thread_with_info (ptid_t ptid, struct private_thread_info *private) > { > + char *name; > struct thread_info *result = add_thread_silent (ptid); > > + name = result->name ? result->name : target_thread_name (result); This pattern is used five times in your patch, and why don't we move it to a function? like, const char * thread_info_name (struct thread_info *ti) { return ti->name ? ti->name : target_thread_name (ti); } and call this function when needed. -- Yao