From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by sourceware.org (Postfix) with ESMTPS id 1503B385B834 for ; Thu, 25 Jun 2020 17:59:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1503B385B834 Received: by mail-qv1-xf43.google.com with SMTP id u8so3220321qvj.12 for ; Thu, 25 Jun 2020 10:59:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DZr078Wc4y2tGAwodtl9eH7aw4zBUOuD1Sa50xjzGnQ=; b=EJWvapMXIvIiblxnW70VTFTAE+Xa3XdihWuQ5pJWgoJRoe1jRP0BmBIfg26Ea0LaRQ A3ts2r4vxFRgQ6Hqwco944Xr6/HhXXIeVZCbPA+Mvri2Y+ljY6H2x4F9legVnheBtf4S Pv68Efpcmy7VL2lIJSgLyoShLs+g/Yl8UcKDSy8JAlRBe+abIxogm/vR+uV2nGxQishC N/4NBm1Yddei+FYPkA1ZuMnyCTh+XWrIiEaMLrEg05SGlAGM67JeWbC3WumCfkmBKFrO fwiA0GVmh7V12tyw8wI68cZjKCHIR0APguQ9mlEylqCBtKS37t40jBHVUf2aJDI6W4wk Yr7w== X-Gm-Message-State: AOAM5337nxXKA+hbrcwA8DZIW+lfb8ObSGWdhlqXXB0mBZEezlEBMZCI zLPkmyoOnuwMEPtqg3zRYonSfawiue0FCA== X-Google-Smtp-Source: ABdhPJwIdRcnEANw4IZysrcG0E8IAzDvzTAdlU3j7RhQ9rBe0/o8iZ5HO13ViRIiB4lQb0Q8dd0RJA== X-Received: by 2002:a05:6214:2ae:: with SMTP id m14mr38101049qvv.185.1593107980283; Thu, 25 Jun 2020 10:59:40 -0700 (PDT) Received: from [192.168.0.185] ([191.249.225.93]) by smtp.gmail.com with ESMTPSA id x57sm2183931qtk.19.2020.06.25.10.59.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2020 10:59:39 -0700 (PDT) Subject: Re: [PATCH] gdb: make inferior::terminal a unique ptr To: Pedro Alves , Christian Biesinger , Simon Marchi Cc: gdb-patches References: <20200625155517.32173-1-simon.marchi@efficios.com> <5b6a39ca-b29e-262b-1f0c-04fbd21a0c31@palves.net> From: Luis Machado Message-ID: <7ae6c907-4507-e0c3-3a52-6416a8203987@linaro.org> Date: Thu, 25 Jun 2020 14:59:35 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <5b6a39ca-b29e-262b-1f0c-04fbd21a0c31@palves.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2020 17:59:42 -0000 On 6/25/20 2:28 PM, Pedro Alves wrote: > On 6/25/20 6:18 PM, Christian Biesinger via Gdb-patches wrote: >> On Thu, Jun 25, 2020 at 10:55 AM Simon Marchi via Gdb-patches >> wrote: >>> - current_inferior ()->terminal = xstrdup (terminal_name); >>> + current_inferior ()->terminal.reset (xstrdup (terminal_name)); >> >> Perhaps it really should be a std::string? > > I think there's no good reason for that. It's a string that doesn't > ever need to grow/shrink. And then its use is to pass down to > a syscall that accepts C-style null-terminated strings: I tend to agree with Christian. I suppose one positive outcome is to make the code less cumbersome. It's not like xstrdup is great to read anyway. Are we worried about performance implications of passing std::string's around like this?