From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114832 invoked by alias); 23 May 2018 04:59:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113927 invoked by uid 89); 23 May 2018 04:59:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL,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=sk:objfile X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.198.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 04:59:08 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 4650C3B55 for ; Tue, 22 May 2018 23:59:07 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LLrfflVFHlAdrLLrffGSxT; Tue, 22 May 2018 23:59:07 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:56108 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fLLrf-003S5D-26; Tue, 22 May 2018 23:59:07 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 26/42] Remove free_pendings Date: Wed, 23 May 2018 04:59:00 -0000 Message-Id: <20180523045851.11660-27-tom@tromey.com> In-Reply-To: <20180523045851.11660-1-tom@tromey.com> References: <20180523045851.11660-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fLLrf-003S5D-26 X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:56108 X-Source-Auth: tom+tromey.com X-Email-Count: 27 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-05/txt/msg00593.txt.bz2 buildsym.c currently keeps a free list of "struct pending"s. However, this didn't seem necessary to me, and so this patch removes the free list. gdb/ChangeLog 2018-05-22 Tom Tromey * buildsym.c (free_pendings): Remove. (add_symbol_to_list, scoped_free_pendings) (finish_block_internal, buildsym_init): Update. --- gdb/ChangeLog | 6 ++++++ gdb/buildsym.c | 28 +++------------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 516dac6b7e..40176298a2 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -258,10 +258,6 @@ struct buildsym_compunit static struct buildsym_compunit *buildsym_compunit; -/* List of free `struct pending' structures for reuse. */ - -static struct pending *free_pendings; - /* List of blocks already made (lexical contexts already closed). This is used at the end to make the blockvector. */ @@ -303,16 +299,7 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead) don't have a link with room in it, add a new link. */ if (*listhead == NULL || (*listhead)->nsyms == PENDINGSIZE) { - if (free_pendings) - { - link = free_pendings; - free_pendings = link->next; - } - else - { - link = XNEW (struct pending); - } - + link = XNEW (struct pending); link->next = *listhead; *listhead = link; link->nsyms = 0; @@ -360,13 +347,6 @@ scoped_free_pendings::~scoped_free_pendings () { struct pending *next, *next1; - for (next = free_pendings; next; next = next1) - { - next1 = next->next; - xfree ((void *) next); - } - free_pendings = NULL; - for (next = file_symbols; next != NULL; next = next1) { next1 = next->next; @@ -488,13 +468,12 @@ finish_block_internal (struct symbol *symbol, if (static_link != NULL) objfile_register_static_link (objfile, block, static_link); - /* Now "free" the links of the list, and empty the list. */ + /* Now free the links of the list, and empty the list. */ for (next = *listhead; next; next = next1) { next1 = next->next; - next->next = free_pendings; - free_pendings = next; + xfree (next); } *listhead = NULL; @@ -1767,7 +1746,6 @@ buildsym_init () { /* Ensure the scoped_free_pendings destructor was called after the last time. */ - gdb_assert (free_pendings == NULL); gdb_assert (file_symbols == NULL); gdb_assert (global_symbols == NULL); gdb_assert (buildsym_compunit == NULL); -- 2.13.6