From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38128 invoked by alias); 9 Nov 2016 23:41:50 -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 38074 invoked by uid 89); 9 Nov 2016 23:41:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:42734, spots, lived X-HELO: gproxy1.mail.unifiedlayer.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO gproxy1.mail.unifiedlayer.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Nov 2016 23:41:39 +0000 Received: from CMOut01 (cmgw2 [10.0.90.82]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id ABC4C177B8B for ; Wed, 9 Nov 2016 16:39:36 -0700 (MST) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id 5zfY1u0022f2jeq01zfbEX; Wed, 09 Nov 2016 16:39:35 -0700 X-Authority-Analysis: v=2.1 cv=beT4Do/B c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=L24OOQBejmoA:10 a=20KFwNOVAAAA:8 a=-st10cwHCcHqse3IHckA:9 a=e_O65bzb51kRm2y5VmPK:22 Received: from 97-118-168-190.hlrn.qwest.net ([97.118.168.190]:42734 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1c4cSr-00044N-3R; Wed, 09 Nov 2016 16:39:33 -0700 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Use unique_xmalloc_ptr in Python code References: <1478292124-26362-1-git-send-email-tom@tromey.com> <71852739-1e5c-6be8-eb21-822c67bc0ea9@redhat.com> Date: Wed, 09 Nov 2016 23:41:00 -0000 In-Reply-To: <71852739-1e5c-6be8-eb21-822c67bc0ea9@redhat.com> (Pedro Alves's message of "Wed, 9 Nov 2016 23:20:33 +0000") Message-ID: <87lgws5iks.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1c4cSr-00044N-3R X-Source-Sender: 97-118-168-190.hlrn.qwest.net (bapiya) [97.118.168.190]:42734 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-11/txt/msg00242.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: Pedro> IMO, for simplicity sake, we should default to use std::string, unless Pedro> we're ending up storing the result in some long lived objects where Pedro> memory really is a concern (because of many instances), and a final Pedro> string dup/copy to destination wouldn't be too heavy too. I doubt Pedro> that's the case here, but it's not easy to see without trying. Pedro> Did you try a std::string approach first? Nope, I had just started with unique_xmalloc_ptr, and then noticed a few spots -- basically anywhere in the patch calling .release() -- where the ownership is passed on. I didn't really consider that copying the string would be ok. I agree it is, I think I was just being conservative in preserving existing behavior. Pedro> In any case, this is strictly an improvement, so OK with me. Please Pedro> push. Let's get this out of the way of your py-ref series. Pedro> We can convert to std::string at some other point, if desirable. Will do. Thanks. Tom