From patchwork Wed Feb 13 21:29:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31447 Received: (qmail 18188 invoked by alias); 13 Feb 2019 21:29:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 17925 invoked by uid 89); 13 Feb 2019 21:29:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Feb 2019 21:29:33 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 4A8933CE6D7 for ; Wed, 13 Feb 2019 15:29:32 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id u260gSDkj4FKpu260gmjBU; Wed, 13 Feb 2019 15:29:32 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HMSCcQOyPyCHRPqKvsIZwjSR3Ivl+iwzGc46BS+3z5M=; b=G/WN5cKDG4j5YgpF5AnO1LDAbY cxfgUFstO4t3SWO7d7FQnBFfloFFv9iBtAzxPg+HJ9h13sw75DEIuNBaGymWZZqUWGx01YlmQceyl mYWfQSnqhV7GM+4Y96EZttte/; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:42554 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gu260-001UWe-2v; Wed, 13 Feb 2019 15:29:32 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 07/20] Remove last cleanups from solib-svr4.c Date: Wed, 13 Feb 2019 14:29:14 -0700 Message-Id: <20190213212927.9474-8-tom@tromey.com> In-Reply-To: <20190213212927.9474-1-tom@tromey.com> References: <20190213212927.9474-1-tom@tromey.com> This removes the last cleanups from solib-svr4.c, replacing them with uses of make_scope_exit. gdb/ChangeLog 2019-02-13 Tom Tromey * solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct): Use make_scope_exit. --- gdb/ChangeLog | 5 +++++ gdb/solib-svr4.c | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 2b370ef96d0..2301cf94c2f 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1198,8 +1198,10 @@ static const struct gdb_xml_element svr4_library_list_elements[] = static int svr4_parse_libraries (const char *document, struct svr4_library_list *list) { - struct cleanup *back_to = make_cleanup (svr4_free_library_list, - &list->head); + auto cleanup = make_scope_exit ([&] () + { + svr4_free_library_list (&list->head); + }); memset (list, 0, sizeof (*list)); list->tailp = &list->head; @@ -1207,11 +1209,10 @@ svr4_parse_libraries (const char *document, struct svr4_library_list *list) svr4_library_list_elements, document, list) == 0) { /* Parsed successfully, keep the result. */ - discard_cleanups (back_to); + cleanup.release (); return 1; } - do_cleanups (back_to); return 0; } @@ -1374,7 +1375,6 @@ svr4_current_sos_direct (struct svr4_info *info) CORE_ADDR lm; struct so_list *head = NULL; struct so_list **link_ptr = &head; - struct cleanup *back_to; int ignore_first; struct svr4_library_list library_list; @@ -1412,7 +1412,10 @@ svr4_current_sos_direct (struct svr4_info *info) else ignore_first = 1; - back_to = make_cleanup (svr4_free_library_list, &head); + auto cleanup = make_scope_exit ([&] () + { + svr4_free_library_list (&head); + }); /* Walk the inferior's link map list, and build our list of `struct so_list' nodes. */ @@ -1428,7 +1431,7 @@ svr4_current_sos_direct (struct svr4_info *info) if (lm) svr4_read_so_list (lm, 0, &link_ptr, 0); - discard_cleanups (back_to); + cleanup.release (); if (head == NULL) return svr4_default_sos ();