From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28578 invoked by alias); 10 Jun 2011 20:29:35 -0000 Received: (qmail 28564 invoked by uid 22791); 10 Jun 2011 20:29:34 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_FILL_THIS_FORM_SHORT,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 20:29:17 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5AKTGKR007734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 Jun 2011 16:29:16 -0400 Received: from host1.jankratochvil.net (ovpn-113-23.phx2.redhat.com [10.3.113.23]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5AKTE2x016738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 10 Jun 2011 16:29:16 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p5AKTDEh032595 for ; Fri, 10 Jun 2011 22:29:13 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p5AKTCuo032589 for gdb-patches@sourceware.org; Fri, 10 Jun 2011 22:29:12 +0200 Date: Fri, 10 Jun 2011 20:29:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 1/2] Code cleanup: New symbol_filename_ftype Message-ID: <20110610202912.GA31746@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2011-06/txt/msg00139.txt.bz2 Hi, no code change, either I could use filename + fullname names everywhere or - I used - the typedef where one can jump to. I will check it in less than a week. Thanks, Jan gdb/ 2011-06-10 Jan Kratochvil Code cleanup. * dwarf2read.c (dw2_map_symbol_filenames): Use symbol_filename_ftype for fun. * psymtab.c (map_symbol_filenames_psymtab) (map_partial_symbol_filenames): Likewise. * psymtab.h: Include symfile.h. (map_partial_symbol_filenames): Use symbol_filename_ftype for fun. * symfile.h (symbol_filename_ftype): New. (struct quick_symbol_functions): Use symbol_filename_ftype for fun of map_symbol_filenames, clarify more the naming in comment. --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2720,8 +2720,7 @@ dw2_find_pc_sect_symtab (struct objfile *objfile, } static void -dw2_map_symbol_filenames (struct objfile *objfile, - void (*fun) (const char *, const char *, void *), +dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun, void *data) { int i; --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1082,9 +1082,7 @@ read_psymtabs_with_filename (struct objfile *objfile, const char *filename) static void map_symbol_filenames_psymtab (struct objfile *objfile, - void (*fun) (const char *, const char *, - void *), - void *data) + symbol_filename_ftype *fun, void *data) { struct partial_symtab *ps; @@ -1917,9 +1915,7 @@ expand_partial_symbol_names (int (*fun) (const char *, void *), void *data) } void -map_partial_symbol_filenames (void (*fun) (const char *, const char *, - void *), - void *data) +map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data) { struct objfile *objfile; --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -20,6 +20,8 @@ #ifndef PSYMTAB_H #define PSYMTAB_H +#include "symfile.h" + /* A bcache for partial symbols. */ struct psymbol_bcache; @@ -31,9 +33,7 @@ extern struct bcache *psymbol_bcache_get_bcache (struct psymbol_bcache *); void expand_partial_symbol_names (int (*fun) (const char *, void *), void *data); -void map_partial_symbol_filenames (void (*) (const char *, const char *, - void *), - void *); +void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data); extern const struct quick_symbol_functions psym_functions; --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -116,6 +116,11 @@ struct symfile_segment_data int *segment_info; }; +/* Callback for quick_symbol_functions->map_symbol_filenames. */ + +typedef void (symbol_filename_ftype) (const char *filename, + const char *fullname, void *data); + /* The "quick" symbol functions exist so that symbol readers can avoiding an initial read of all the symbols. For example, symbol readers might choose to use the "partial symbol table" utilities, @@ -283,12 +288,10 @@ struct quick_symbol_functions int warn_if_readin); /* Call a callback for every file defined in OBJFILE whose symtab is - not already read in. FUN is the callback. It is passed the file's name, - the file's full name, and the DATA passed to this function. */ + not already read in. FUN is the callback. It is passed the file's + FILENAME, the file's FULLNAME, and the DATA passed to this function. */ void (*map_symbol_filenames) (struct objfile *objfile, - void (*fun) (const char *, const char *, - void *), - void *data); + symbol_filename_ftype *fun, void *data); }; /* Structure to keep track of symbol reading functions for various