From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59348 invoked by alias); 6 Sep 2019 23:47:48 -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 59340 invoked by uid 89); 6 Sep 2019 23:47:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-30.7 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=HX-Languages-Length:4248, H*c:alternative, device X-HELO: mail-oi1-f171.google.com Received: from mail-oi1-f171.google.com (HELO mail-oi1-f171.google.com) (209.85.167.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 23:47:46 +0000 Received: by mail-oi1-f171.google.com with SMTP id x7so6405573oie.13 for ; Fri, 06 Sep 2019 16:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UoEVsYt4an/BR0J6V6UtGekHvZf9mssnZwmAYA8EfAc=; b=E0UCREusQ74bCQmhFbsgK6EeEjWIFgBovDuwsck1sSuCx03yUgSwgayKZ74OREsEVh njIOmGoJK//shHfNPOPLYyWCGhhYLlGvclOM0SrgwWIOp0cwAawObez1jH7ZYWRA+d/9 xDbTJdfhLjJG3jpd03Qmt8ImYm+/1cCcgIgvBSpVS2TMQM8i/Pq9T/WkzwhUCFedp+Rk 7DVZVYET3UytK9V0JKTp4n1VzNu14WBez//wEmlK8tReLtuyTs+Zr1GDiQnR5q90QRUk 7HuXS5B1/UGhU3jOEdZrzpWlNQcllKNM23WbV6Ko68RbF0bIMIjEaLBolf9ojd3d4xZK 1NGw== MIME-Version: 1.0 References: <20190906232807.6191-1-palves@redhat.com> <20190906232807.6191-21-palves@redhat.com> In-Reply-To: <20190906232807.6191-21-palves@redhat.com> From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Fri, 06 Sep 2019 23:47:00 -0000 Message-ID: Subject: Re: [PATCH 20/23] Revert 'Remove unused struct serial::name field' To: Pedro Alves Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00100.txt.bz2 Have you considered making this an std::string to avoid needing the manual xfree? On Fri, Sep 6, 2019, 18:29 Pedro Alves wrote: > This commit reverts: > > commit 5f5219fc34f7557296272230123a3837960a6f09 > Author: Pedro Alves > AuthorDate: Tue Apr 12 16:49:30 2016 +0100 > > Remove unused struct serial::name field > > The following patches will add uses for the field. > > gdb/ChangeLog: > yyyy-mm-dd Pedro Alves > > Revert: > 2016-04-12 Pedro Alves > * serial.c (serial_open, serial_fdopen_ops, do_serial_close): > Remove references to name. > * serial.h (struct serial) : Delete. > --- > gdb/serial.c | 4 ++++ > gdb/serial.h | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/gdb/serial.c b/gdb/serial.c > index a881bbc97c..0ed3d37406 100644 > --- a/gdb/serial.c > +++ b/gdb/serial.c > @@ -247,6 +247,7 @@ serial_open_ops_1 (const struct serial_ops *ops, const > char *open_name) > return NULL; > } > > + scb->name = open_name != NULL ? xstrdup (open_name) : NULL; > scb->next = scb_base; > scb_base = scb; > > @@ -291,6 +292,7 @@ serial_fdopen_ops (const int fd, const struct > serial_ops *ops) > > scb = new_serial (ops); > > + scb->name = NULL; > scb->next = scb_base; > scb_base = scb; > > @@ -330,6 +332,8 @@ do_serial_close (struct serial *scb, int really_close) > if (really_close) > scb->ops->close (scb); > > + xfree (scb->name); > + > /* For serial_is_open. */ > scb->bufp = NULL; > > diff --git a/gdb/serial.h b/gdb/serial.h > index b75b3666e7..d58ab660e9 100644 > --- a/gdb/serial.h > +++ b/gdb/serial.h > @@ -240,6 +240,7 @@ struct serial > buffer. -ve for sticky errors. */ > unsigned char *bufp; /* Current byte */ > unsigned char buf[BUFSIZ]; /* Da buffer itself */ > + char *name; /* The name of the device or host > */ > struct serial *next; /* Pointer to the next `struct serial *' */ > int debug_p; /* Trace this serial devices operation. */ > int async_state; /* Async internal state. */ > -- > 2.14.5 > >