From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22663 invoked by alias); 23 Oct 2007 10:16:56 -0000 Received: (qmail 22651 invoked by uid 22791); 23 Oct 2007 10:16:55 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 23 Oct 2007 10:16:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 89B4F2AA429 for ; Tue, 23 Oct 2007 06:16:51 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IuWOqIjyDqy4 for ; Tue, 23 Oct 2007 06:16:51 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 148AF2AA442 for ; Tue, 23 Oct 2007 06:16:51 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 0CFD6E7AC8; Tue, 23 Oct 2007 03:16:49 -0700 (PDT) Date: Tue, 23 Oct 2007 10:21:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] small cleanup in buildsym.c Message-ID: <20071023101649.GJ4150@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cNdxnHkX5QqsyA0e" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i 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 X-SW-Source: 2007-10/txt/msg00532.txt.bz2 --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 920 Hello, While doing some code cleanup in our sources, I noticed that buildsym had some #if 0 and some #if 1. This patch addresses the ones that look the most obvious to me, the #if 0. I don't know why this code was #ifdef'ed out instead of simply deleted. cvs annotate shows that it predates the public CVS. Since it's been 8 years, I think we can safely remove them. I noticed one area where we could actually factorize the code, even if actual function body is the same as the one line we're replacing, the function has a comment inside that explains why we're doing so little. 2007-10-23 Joel Brobecker * buildsym.c (free_pending_blocks): Remove commented-out code. (make_blockvector): Likewise. Re-use free_pending_blocks. (end_symtab): Remove commented-out code. Seems pretty straightforward, but I will run it through the testsuite before committing. -- Joel --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="buildsym.c.diff" Content-length: 2003 Index: buildsym.c =================================================================== RCS file: /cvs/src/src/gdb/buildsym.c,v retrieving revision 1.53 diff -u -p -r1.53 buildsym.c --- buildsym.c 12 Oct 2007 15:34:45 -0000 1.53 +++ buildsym.c 23 Oct 2007 10:12:27 -0000 @@ -198,17 +198,8 @@ really_free_pendings (void *dummy) void free_pending_blocks (void) { -#if 0 /* Now we make the links in the - objfile_obstack, so don't free - them. */ - struct pending_block *bnext, *bnext1; - - for (bnext = pending_blocks; bnext; bnext = bnext1) - { - bnext1 = bnext->next; - xfree ((void *) bnext); - } -#endif + /* The links are made in the objfile_obstack, so we only need to + reset PENDING_BLOCKS. */ pending_blocks = NULL; } @@ -493,17 +484,7 @@ make_blockvector (struct objfile *objfil BLOCKVECTOR_BLOCK (blockvector, --i) = next->block; } -#if 0 /* Now we make the links in the - obstack, so don't free them. */ - /* Now free the links of the list, and empty the list. */ - - for (next = pending_blocks; next; next = next1) - { - next1 = next->next; - xfree (next); - } -#endif - pending_blocks = NULL; + free_pending_blocks (); #if 1 /* FIXME, shut this off after a while to speed up symbol reading. */ @@ -976,14 +957,6 @@ end_symtab (CORE_ADDR end_addr, struct o { linetablesize = sizeof (struct linetable) + subfile->line_vector->nitems * sizeof (struct linetable_entry); -#if 0 - /* I think this is artifact from before it went on the - obstack. I doubt we'll need the memory between now - and when we free it later in this function. */ - /* First, shrink the linetable to make more memory. */ - subfile->line_vector = (struct linetable *) - xrealloc ((char *) subfile->line_vector, linetablesize); -#endif /* Like the pending blocks, the line table may be scrambled in reordered executables. Sort it if --cNdxnHkX5QqsyA0e--