From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EZnXJU7cz2q37QoAWB0awg (envelope-from ) for ; Wed, 14 Oct 2026 15:47:26 -0400 Received: by simark.ca (Postfix, from userid 112) id EF0971E090; Wed, 14 Oct 2026 15:47:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BB6631E04E for ; Wed, 14 Oct 2026 15:46:36 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AB844BA23D5 for ; Wed, 14 Oct 2026 19:46:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AB844BA23D5 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 642904BA2E1D for ; Wed, 14 Oct 2026 19:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 642904BA2E1D Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 642904BA2E1D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792007171; cv=none; b=hyCpjPDyhrC21c/5+wtiy50rplqU3mp7x483H/QNJbad5ElnkbRItBHCAJ4HVPt98O/pluwXfYJCyWGTXyURQBb3Lzjh7J3C268c4qFVvQRaK3uAGYv5sloVMBHPd66hxl5t6mVNpk4e6Sa8DIBp80eZtAjbPsK1X3bylKY0DYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792007171; c=relaxed/simple; bh=pQO9BrwB2xLjztCE6fljlfzssQWsz5M0QM3Z6sL4bWc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=fyJP4esG344FMtDafPdCQU2CuiLbZmAMKahGrkBoDUH/SoEfg4lOg5AEFQvEqpPFEFaSMq6qRWNo3F0IYTIGy2PxUkGLwVugozpRNBYUwFIhoEmzKMhI/F49J80qyQ553ndeiDXlrjgplE9nrD5PgaTibelCurWRw4oBRU/yAek= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 642904BA2E1D Received: by simark.ca (Postfix) id 4B9971E04F; Wed, 14 Oct 2026 15:46:09 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [pushed 2/2] gdb: make gdb_cplus_demangle_print return gdb::unique_xmalloc_ptr Date: Wed, 14 Oct 2026 15:46:02 -0400 Message-ID: <20261014194606.523510-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261014194606.523510-1-simon.marchi@efficios.com> References: <20261014194606.523510-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Change gdb_cplus_demangle_print to return a gdb::unique_xmalloc_ptr instead of a raw pointer. Change-Id: I116c0e53f504b926848afa9b398c2ddf88dbe0b4 --- gdb/cp-name-parser.c | 5 ++--- gdb/cp-support.c | 7 ++++--- gdb/cp-support.h | 7 +++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gdb/cp-name-parser.c b/gdb/cp-name-parser.c index 80779fbc6062..fe2ffd61a6c8 100644 --- a/gdb/cp-name-parser.c +++ b/gdb/cp-name-parser.c @@ -382,9 +382,8 @@ cp_comp_to_string (struct demangle_component *result, int estimated_len) { size_t err; - char *res = gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, - result, estimated_len, &err); - return gdb::unique_xmalloc_ptr (res); + return gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, + estimated_len, &err); } /* Merge the two parse trees given by DEST and SRC. The parse tree diff --git a/gdb/cp-support.c b/gdb/cp-support.c index c386f7fea271..3881d4b4cdeb 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1678,14 +1678,15 @@ gdb_demangle (const char *name, int options) /* See cp-support.h. */ -char * +gdb::unique_xmalloc_ptr gdb_cplus_demangle_print (int options, struct demangle_component *tree, int estimated_length, size_t *p_allocated_size) { - return cplus_demangle_print (options | DMGL_VERBOSE, tree, - estimated_length, p_allocated_size); + return gdb::unique_xmalloc_ptr + (cplus_demangle_print (options | DMGL_VERBOSE, tree, + estimated_length, p_allocated_size)); } /* A wrapper for cplus_demangle_v3_components that forces diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 87eee25a5798..2263d5b725c0 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -202,10 +202,9 @@ gdb::unique_xmalloc_ptr gdb_demangle (const char *name, int options); /* A wrapper for cplus_demangle_print. */ -extern char *gdb_cplus_demangle_print (int options, - struct demangle_component *tree, - int estimated_length, - size_t *p_allocated_size); +extern gdb::unique_xmalloc_ptr gdb_cplus_demangle_print + (int options, struct demangle_component *tree, int estimated_length, + size_t *p_allocated_size); /* Find an instance of the character C in the string S that is outside of all parenthesis pairs, single-quoted strings, and double-quoted -- 2.56.0