From patchwork Sat Jan 5 20:41:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 30967 Received: (qmail 94744 invoked by alias); 5 Jan 2019 20:41:19 -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 94720 invoked by uid 89); 5 Jan 2019 20:41:18 -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=UD:y, Storage, H*Ad:U*tom, H*RU:sk:gateway X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.62.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 05 Jan 2019 20:41:16 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 4069C400C4F03 for ; Sat, 5 Jan 2019 14:41:15 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fsktgQuLS4FKpfsktgsxtX; Sat, 05 Jan 2019 14:41:15 -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=xciLTT1oZJdtVRBZP3YCG0uHebnOX2a/SEC4Id9u4DA=; b=FCxViuddsI+4vdNPu5TXptNomM pTIQKkThEHD/1mbiXFRS60v06sbvHVPr14h76E9pAr2xNzCIQrAj+oESfVtKCBDTo65sU1xAqpng2 22vYFXbvo4csq5tLcX6SjGJ8q; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:34446 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gfskt-000OXk-0Y; Sat, 05 Jan 2019 14:41:15 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/3] Remove string-related cleanup from c-exp.y Date: Sat, 5 Jan 2019 13:41:11 -0700 Message-Id: <20190105204112.26849-3-tom@tromey.com> In-Reply-To: <20190105204112.26849-1-tom@tromey.com> References: <20190105204112.26849-1-tom@tromey.com> This removes a string-related cleanup from c-exp.y, by adding a new member to c_parse_state to store the strings. gdb/ChangeLog 2019-01-05 Tom Tromey * c-exp.y (struct c_parse_state) : New member. (operator_stoken): Update. --- gdb/ChangeLog | 5 +++++ gdb/c-exp.y | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index eb6a6847cf..83b2aa3fdd 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -74,6 +74,9 @@ struct c_parse_state allocated during the parse. */ std::vector>> type_lists; std::vector> type_stacks; + + /* Storage for some strings allocated during the parse. */ + std::vector> strings; }; /* This is set and cleared in c_parse. */ @@ -1743,7 +1746,7 @@ operator_stoken (const char *op) st.ptr = buf; /* The toplevel (c_parse) will free the memory allocated here. */ - make_cleanup (free, buf); + cpstate->strings.emplace_back (buf); return st; };