From patchwork Wed Feb 27 20:18:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31651 Received: (qmail 114439 invoked by alias); 27 Feb 2019 20:18:58 -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 114298 invoked by uid 89); 27 Feb 2019 20:18:57 -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=do_cleanups, our X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Feb 2019 20:18:56 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway24.websitewelcome.com (Postfix) with ESMTP id C64FB6F98 for ; Wed, 27 Feb 2019 14:18:54 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id z5fKg62mtYTGMz5fKgMsJ6; Wed, 27 Feb 2019 14:18:54 -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=D+ba4DhgOFusLk7w8ZQvEEl2tAqVh5I8VQksFfKPX3Y=; b=JAetttqwTAhHivqB837E+fGAo2 c390VgazSnLiIIhZCPlXn9xJWDASZgWIYdVpRw6wf3P4XnY8SXzurazICaMBy6c9Hav9r7PaKeR70 vYe6uN9ZFzdBymZD36PDaNUHP; Received: from 75-166-85-218.hlrn.qwest.net ([75.166.85.218]:36364 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gz5fK-004Fi1-JL; Wed, 27 Feb 2019 14:18:54 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 07/22] Remove last cleanups from solib-svr4.c Date: Wed, 27 Feb 2019 13:18:34 -0700 Message-Id: <20190227201849.32210-8-tom@tromey.com> In-Reply-To: <20190227201849.32210-1-tom@tromey.com> References: <20190227201849.32210-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-27 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 ();