From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by sourceware.org (Postfix) with ESMTPS id CBF473851C16 for ; Thu, 25 Jun 2020 17:28:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CBF473851C16 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f67.google.com with SMTP id g18so6733946wrm.2 for ; Thu, 25 Jun 2020 10:28: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:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=piXiRnY6TWSQhuUfyPumWE6YgFZ84Bnv3Lf9jXNEcJM=; b=SUvRRKeUvG893Vu470oR0YfTw+SrVLNuGidMrlIMt7dVfoK8Xgnq28RvSQCLiwYB+c uzLDW/Q9UMZFgLcLOI/7Gh78hGQa3MPiJhR0T15VmHkgB2pgseTMFpsuDBz0qlDgmy9R BiP5dvZFhQV4nLFom6FlgqtzpJRbxmJos7O1EJWSOov9DD03h9GRc/SKVjMoaagvSF72 AAWLs3wIhGoaiCiMvsrO0pkMnFHfpmE+HBzniQWUuoVTp61S6s9RcKMYZNdFhvw7bRjC RxjjLYFhi2MRPkKVn/TLje2yDmRXncktchYi88aBfQqvCwi193B8qVctZ3+QVMcqYiiZ fFCg== X-Gm-Message-State: AOAM5300ePUt15MU3LAhetXGp2S2oxrNRSSezYfzntp1ipizl9YU7+8K OqVwPVqSGbjg4dbgROFZOp2pC08tIiw= X-Google-Smtp-Source: ABdhPJx1Bp8N0yscsFg/jJzdGHI+9XYgYttiSJjrkEzJ7C6yIEIE+fHwnP1YaoOuA3nUPlGAEgg4tw== X-Received: by 2002:adf:c142:: with SMTP id w2mr32928135wre.337.1593106120416; Thu, 25 Jun 2020 10:28:40 -0700 (PDT) Received: from ?IPv6:2001:8a0:f922:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f922:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id d2sm32833386wrs.95.2020.06.25.10.28.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2020 10:28:37 -0700 (PDT) Subject: Re: [PATCH] gdb: make inferior::terminal a unique ptr To: Christian Biesinger , Simon Marchi References: <20200625155517.32173-1-simon.marchi@efficios.com> Cc: gdb-patches From: Pedro Alves Message-ID: <5b6a39ca-b29e-262b-1f0c-04fbd21a0c31@palves.net> Date: Thu, 25 Jun 2020 18:28:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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:28:43 -0000 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: tty = open (inferior_thisrun_terminal, O_RDWR | O_NOCTTY); (and printf logging) I.e., tracking the string's size doesn't help anything. Thanks, Pedro Alves