From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63791 invoked by alias); 8 Dec 2018 15:12:20 -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 62889 invoked by uid 89); 8 Dec 2018 15:12:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=regex, invocations X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Dec 2018 15:12:18 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F70F308A94C; Sat, 8 Dec 2018 15:12:17 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CA1E5DAA0; Sat, 8 Dec 2018 15:12:16 +0000 (UTC) Subject: Re: [PATCH] Merge forward-search/reverse-search, use gdb::def_vector, remove limit (Re: [RFA] Fix leak in forward-search) To: Tom Tromey References: <20181127233328.5164-1-philippe.waroquiers@skynet.be> <3cf960b8-ff82-0670-fa90-c94d78573bfe@redhat.com> <1543532723.4149.7.camel@skynet.be> <6e8a2a00-bcbd-cdc6-f332-f59988bb8c40@redhat.com> <871s72mh5i.fsf@tromey.com> Cc: Philippe Waroquiers , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <037c46b7-77b3-b966-69f3-ecb522ebd23c@redhat.com> Date: Sat, 08 Dec 2018 15:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <871s72mh5i.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-12/txt/msg00105.txt.bz2 On 11/30/2018 08:42 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> -/* FIXME!!! We walk right off the end of buf if we get a long line!!! */ > > I'm surprised all those exclamation marks didn't help us find this > sooner. /s > > Pedro> I don't think there's much point in reusing the buffer across > Pedro> command invocations. > > Agreed. > > Pedro> - msg = (char *) re_comp (regex); > Pedro> + char *msg = (char *) re_comp (regex); > > Pre-existing, but I wonder why this cast is needed. I think "const char > *msg" and removing the cast ought to be completely fine. Yeah. I did this, and pushed the patch. > Or (more work) > avoid re_comp and use compiled_regex instead. I looked at this a bit, but decided not to do it, at least not in this patch, because there are several other re_comp calls in the tree, which made me think that it'd be better to do a pass tweaking all the same time. While considering that, it seems like we end up having to pass a string as 3rd argument to compile_regex's ctor and many different places, which makes me think that perhaps that argument should have a default. Similar consideration for the compile_regex::exec method, and all arguments but the first. Thanks, Pedro Alves > > The rest seems fine to me. Thank you for doing this. > > Tom >