From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A46093858C2D for ; Mon, 14 Aug 2023 13:42:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A46093858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692020562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b7aYaumiCdBWy4gBQk7sAHyXv+9HWGe9SqKnZ9pq4wE=; b=HHxsKHLen5gEUHGk5i4X2t8yjOqIXmT8bH7L9t0XNriU9b+KqZkA3gqJN4DUM+lU0BmYqq seCMfADGOcox7UEiZuJN1WlR9m+x83pmB0rW+9MvzaGiARrKOFNk6JCYxeuSueW2715w0/ saAd2Y5T35Grm5VZC3aW0N/z9mBc8DY= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-5HxFZhv3PAW7BZnx2qYxeA-1; Mon, 14 Aug 2023 09:42:40 -0400 X-MC-Unique: 5HxFZhv3PAW7BZnx2qYxeA-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-51a5296eb8eso2903992a12.2 for ; Mon, 14 Aug 2023 06:42:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692020559; x=1692625359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b7aYaumiCdBWy4gBQk7sAHyXv+9HWGe9SqKnZ9pq4wE=; b=KE1/lZM/vKPeSp0V5O+5UMO9eqQAG3JtAksPPILLhaQzhlV9cBTvtgTaofZKfDIe7m p0sTBup1BqJzpCExmVAQOD5CxMEj8PQatF3ToGjD5+J1wH8tTx74UIjdmRavJwfe66Vg QDMDgO1umM/r9yo9o63OIeqb90qgiCxqPDxEhAyCjJFUSGA4m+ih+znx5e+9lHNz8eBY y8ZTjLD5GvBzOspyxdka1u2jsLeXnKGWi2c0I75dolbQ7RQ8vzfbOiHfVHhzVoE0U9sl sIqU2/IIy6Y/ivTv6Syo3aPkDOmf3ialjJE78Q/UCaEypbU2I8gB2Sa/jjZfsEvRayJ1 iJdQ== X-Gm-Message-State: AOJu0Yz1Aghq/aTwqlraiUHa0pgKkq0nYRREcBI4TalpIUaEslkz0mc2 ST2d/B7ig776+XVDlr4ATjiuz/RJ8O1HsFELKkVV4FSFzhn1zBG62EfAHgu7rdqPJAAGxwFhz2R ahHTNmG4LFnZtsG6vo6TnMhCFjv1ImcrTWJOsJZrF27K67zIh5ji3cFILJgSwoIi+CzegXyhT5j LXpAWk/A== X-Received: by 2002:aa7:cb93:0:b0:523:1ea3:b9a6 with SMTP id r19-20020aa7cb93000000b005231ea3b9a6mr6106551edt.39.1692020559641; Mon, 14 Aug 2023 06:42:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTfoW6QEwSOPoykydF190EeUPBkO8h5ZOxKTVD+Blw/06y7tVeOkrtTFkRdHJZYFBQMO/AzQ== X-Received: by 2002:aa7:cb93:0:b0:523:1ea3:b9a6 with SMTP id r19-20020aa7cb93000000b005231ea3b9a6mr6106546edt.39.1692020559406; Mon, 14 Aug 2023 06:42:39 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id r8-20020aa7d588000000b0052369aa9956sm5573504edq.26.2023.08.14.06.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 06:42:39 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess Subject: [PATCH 2/3] gdb: have mi_out_new return std::unique_ptr Date: Mon, 14 Aug 2023 14:42:33 +0100 Message-Id: <80d10aa41eab1bccd30560880c3547f30331207c.1692019711.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Have the mi_out_new function return a std::unique_ptr instead of a raw pointer. Update the two uses of mi_out_new. There should be no user visible changes after this commit. --- gdb/mi/mi-interp.c | 2 +- gdb/mi/mi-main.c | 2 +- gdb/mi/mi-out.c | 8 ++++---- gdb/mi/mi-out.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 0e51c884a65..a7fcf17e51c 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -95,7 +95,7 @@ mi_interp::init (bool top_level) mi->log = mi->err; mi->targ = new mi_console_file (mi->raw_stdout, "@", '"'); mi->event_channel = new mi_console_file (mi->raw_stdout, "=", 0); - mi->mi_uiout = mi_out_new (name ()); + mi->mi_uiout = mi_out_new (name ()).release (); gdb_assert (mi->mi_uiout != nullptr); mi->cli_uiout = new cli_ui_out (mi->out); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 0ac2c74153d..f9bc1cb9cfb 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2207,7 +2207,7 @@ mi_load_progress (const char *section_name, which means uiout may not be correct. Fix it for the duration of this function. */ - std::unique_ptr uiout (mi_out_new (current_interpreter ()->name ())); + auto uiout = mi_out_new (current_interpreter ()->name ()); if (uiout == nullptr) return; diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 29a416a426d..bbd21287b28 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -336,17 +336,17 @@ mi_ui_out::~mi_ui_out () /* See mi/mi-out.h. */ -mi_ui_out * +std::unique_ptr mi_out_new (const char *mi_version) { if (streq (mi_version, INTERP_MI4) || streq (mi_version, INTERP_MI)) - return new mi_ui_out (4); + return gdb::make_unique (4); if (streq (mi_version, INTERP_MI3)) - return new mi_ui_out (3); + return gdb::make_unique (3); if (streq (mi_version, INTERP_MI2)) - return new mi_ui_out (2); + return gdb::make_unique (2); return nullptr; } diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index 10c9f8a4585..0dd7479a52f 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -143,7 +143,7 @@ class mi_ui_out : public ui_out to one of the INTERP_MI* constants (see interps.h). Return nullptr if an invalid version is provided. */ -mi_ui_out *mi_out_new (const char *mi_version); +std::unique_ptr mi_out_new (const char *mi_version); void mi_out_put (ui_out *uiout, struct ui_file *stream); void mi_out_rewind (ui_out *uiout); -- 2.25.4