From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19630 invoked by alias); 24 Jun 2014 03:11:38 -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 19613 invoked by uid 89); 24 Jun 2014 03:11:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jun 2014 03:11:35 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WzH8t-0005ez-Bj from Yao_Qi@mentor.com ; Mon, 23 Jun 2014 20:11:31 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 23 Jun 2014 20:11:31 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Mon, 23 Jun 2014 20:11:02 -0700 Message-ID: <53A8EC05.2030901@codesourcery.com> Date: Tue, 24 Jun 2014 03:11:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Tom Tromey , Subject: Re: [PATCH] constify search_symbols References: <1403285060-5556-1-git-send-email-tromey@redhat.com> In-Reply-To: <1403285060-5556-1-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00833.txt.bz2 On 06/21/2014 01:24 AM, Tom Tromey wrote: > - char **files = NULL, *file_name; > + const char **files = NULL; > + const char *file_name; > int nfiles = 0; > > if (regexp) > @@ -3960,13 +3961,15 @@ rbreak_command (char *regexp, int from_tty) > if (colon && *(colon + 1) != ':') > { > int colon_index; > + char *local_name; > > colon_index = colon - regexp; > - file_name = alloca (colon_index + 1); > - memcpy (file_name, regexp, colon_index); > - file_name[colon_index--] = 0; > - while (isspace (file_name[colon_index])) > - file_name[colon_index--] = 0; > + local_name = alloca (colon_index + 1); > + memcpy (local_name, regexp, colon_index); > + local_name[colon_index--] = 0; > + while (isspace (local_name[colon_index])) > + local_name[colon_index--] = 0; > + file_name = local_name; file_name isn't used out side of this block, so we can define file_name within this block of type "char *", and patch can be shorter. -- Yao (齐尧)