From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 2F9163858D35 for ; Wed, 7 Oct 2020 18:26:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F9163858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EA39A117E0B; Wed, 7 Oct 2020 14:26:05 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1AAahJvjotLi; Wed, 7 Oct 2020 14:26:05 -0400 (EDT) Received: from murgatroyd (174-16-122-38.hlrn.qwest.net [174.16.122.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 8D20A117E0A; Wed, 7 Oct 2020 14:26:05 -0400 (EDT) From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] Constify ada_encode return type References: <20201002202604.1517475-1-tromey@adacore.com> <20201002202604.1517475-2-tromey@adacore.com> <6864fd19-d99f-7066-1eef-7dbbf6f2d84f@simark.ca> X-Attribution: Tom Date: Wed, 07 Oct 2020 12:26:05 -0600 In-Reply-To: <6864fd19-d99f-7066-1eef-7dbbf6f2d84f@simark.ca> (Simon Marchi's message of "Fri, 2 Oct 2020 17:51:13 -0400") Message-ID: <87sgapoptu.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Wed, 07 Oct 2020 18:26:07 -0000 >> + const char *temp_name = ada_encode (name0.ptr); >> + name_len = strlen (temp_name); >> + encoded_name = obstack_strndup (&temp_parse_space, temp_name, name_len); Simon> Could this be further simplified to: Simon> encoded_name = obstack_strdup (&temp_parse_space, ada_encode (name0.ptr)); Simon> ? name_len is used later in the function, so this would involve an extra strlen. Tom