From patchwork Tue Nov 11 00:52:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3644 Received: (qmail 32324 invoked by alias); 11 Nov 2014 00:53:38 -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 32051 invoked by uid 89); 11 Nov 2014 00:53:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: mail-pd0-f178.google.com Received: from mail-pd0-f178.google.com (HELO mail-pd0-f178.google.com) (209.85.192.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 11 Nov 2014 00:53:36 +0000 Received: by mail-pd0-f178.google.com with SMTP id fp1so8916622pdb.37 for ; Mon, 10 Nov 2014 16:53:34 -0800 (PST) X-Received: by 10.70.3.196 with SMTP id e4mr36173776pde.35.1415667214273; Mon, 10 Nov 2014 16:53:34 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id of9sm17655663pbc.6.2014.11.10.16.53.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Nov 2014 16:53:33 -0800 (PST) From: Doug Evans To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] select_source_symtab: Rewrite to use ALL_SYMTABS. Date: Mon, 10 Nov 2014 16:52:42 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. This is just a simple cleanup. The function is looping over all objfiles with ALL_OBJFILES and then handcoding the loop over all symtabs. This can be replaced with ALL_SYMTABS. Committed. 2014-11-10 Doug Evans * source.c (select_source_symtab): Rewrite to use ALL_SYMTABS. diff --git a/gdb/source.c b/gdb/source.c index 19c2562..1bb19c9 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -291,19 +291,16 @@ select_source_symtab (struct symtab *s) current_source_line = 1; - ALL_OBJFILES (ofp) + ALL_SYMTABS (ofp, s) { - for (s = ofp->symtabs; s; s = s->next) - { - const char *name = s->filename; - int len = strlen (name); + const char *name = s->filename; + int len = strlen (name); - if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 - || strcmp (name, "<>") == 0))) - { - current_source_pspace = current_program_space; - current_source_symtab = s; - } + if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 + || strcmp (name, "<>") == 0))) + { + current_source_pspace = current_program_space; + current_source_symtab = s; } }