From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63128 invoked by alias); 19 Oct 2016 23:19:24 -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 63103 invoked by uid 89); 19 Oct 2016 23:19:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*r:112, XCNEWVEC, xcnewvec, 3730 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 23:19:21 +0000 Received: by simark.ca (Postfix, from userid 112) id 65F291E191; Wed, 19 Oct 2016 19:19:20 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id C37BD1E124; Wed, 19 Oct 2016 19:19:19 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2016 23:19:00 -0000 From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 29/31] 'struct agent_expr *' -> unique_ptr In-Reply-To: <1476839539-8374-30-git-send-email-palves@redhat.com> References: <1476839539-8374-1-git-send-email-palves@redhat.com> <1476839539-8374-30-git-send-email-palves@redhat.com> Message-ID: <57020f6d8d6c087cc8ea35f49860e7d8@simark.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.0 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00593.txt.bz2 On 2016-10-18 21:12, Pedro Alves wrote: > diff --git a/gdb/ax-general.c b/gdb/ax-general.c > index 7f27a45..35225f6 100644 > --- a/gdb/ax-general.c > +++ b/gdb/ax-general.c > @@ -37,52 +37,30 @@ static void generic_ext (struct agent_expr *x, > enum agent_op op, int n); > > /* Functions for building expressions. */ > > -/* Allocate a new, empty agent expression. */ > -struct agent_expr * > -new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope) > +agent_expr::agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope) > { > - struct agent_expr *x = XNEW (struct agent_expr); > - > - x->len = 0; > - x->size = 1; /* Change this to a larger value once > + this->len = 0; > + this->size = 1; /* Change this to a larger value once > reallocation code is tested. */ > - x->buf = (unsigned char *) xmalloc (x->size); > + this->buf = (unsigned char *) xmalloc (this->size); > > - x->gdbarch = gdbarch; > - x->scope = scope; > + this->gdbarch = gdbarch; > + this->scope = scope; > > /* Bit vector for registers used. */ > - x->reg_mask_len = 1; > - x->reg_mask = XCNEWVEC (unsigned char, x->reg_mask_len); > - > - x->tracing = 0; > - x->trace_string = 0; > + this->reg_mask_len = 1; > + this->reg_mask = XCNEWVEC (unsigned char, this->reg_mask_len); > > - return x; > + this->tracing = 0; > + this->trace_string = 0; > } In one of Tom's patches, you said to drop the "this->". Did you leave them here for clarity? Would you remove them if the structure was completely converted, with m_ prefixed members (given that the m_ prefix makes it clear enough that it's a member)? > @@ -12385,13 +12378,9 @@ force_breakpoint_reinsertion (struct > bp_location *bl) > that have already been marked. */ > loc->condition_changed = condition_updated; > > - /* Free the agent expression bytecode as well. We will compute > - it later on. */ > - if (loc->cond_bytecode) > - { > - free_agent_expr (loc->cond_bytecode); > - loc->cond_bytecode = NULL; > - } > + /* Release the agent expression bytecode as well. We will > + compute it later on. */ > + loc->cond_bytecode.reset (); Why did you change Free for Release in the comment? Since release has a different meaning when using unique pointers, it sounds more confusing like this I think.