From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10935 invoked by alias); 5 Aug 2008 19:51:14 -0000 Received: (qmail 10926 invoked by uid 22791); 5 Aug 2008 19:51:13 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Aug 2008 19:50:39 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m75JoaBo028614 for ; Tue, 5 Aug 2008 15:50:36 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m75JoZES012748; Tue, 5 Aug 2008 15:50:35 -0400 Received: from opsy.redhat.com (vpn-10-102.bos.redhat.com [10.16.10.102]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m75JoYY2025980; Tue, 5 Aug 2008 15:50:35 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id B2C47508577; Tue, 5 Aug 2008 13:50:34 -0600 (MDT) To: gdb-patches@sourceware.org Subject: RFA: remove deprecated bcache functions From: Tom Tromey Reply-To: Tom Tromey X-Attribution: Tom Date: Tue, 05 Aug 2008 19:51:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2008-08/txt/msg00086.txt.bz2 I happened to notice some bcache functions marked deprecated. So, as part of my quest to eventually nuke all deprecated things from gdb, I wrote this patch. This required a little const-fixing in symfile.c. This is incomplete; a full patch is pretty big and IMO this patch is a reasonable improvement. I picked the name "bcache_full" based on the "_full" convention from other projects. Bootstrapped and regtested on x86-64 (compile farm). Ok? Tom b/gdb/ChangeLog: 2008-08-05 Tom Tromey * symfile.c (add_psymbol_to_bcache): Return a const pointer. Use bcache_full. (append_psymbol_to_list): Accept a const pointer. (add_psymbol_to_list): Fix const correctness. * bcache.h: (deprecated_bcache_added, deprecated_bcache): Remove. (bcache_full): Declare. * bcache.c (bcache_data, deprecated_bcache): Remove. (bcache): Use bcache_full. (bcache_full): Rename from deprecated_bcache_added. Change return type. diff --git a/gdb/bcache.c b/gdb/bcache.c index 9f7a915..589de6a 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -194,23 +194,10 @@ expand_hash_table (struct bcache *bcache) /* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has never seen those bytes before, add a copy of them to BCACHE. In either case, return a pointer to BCACHE's copy of that string. */ -static void * -bcache_data (const void *addr, int length, struct bcache *bcache) -{ - return deprecated_bcache_added (addr, length, bcache, NULL); -} - - -void * -deprecated_bcache (const void *addr, int length, struct bcache *bcache) -{ - return bcache_data (addr, length, bcache); -} - const void * bcache (const void *addr, int length, struct bcache *bcache) { - return bcache_data (addr, length, bcache); + return bcache_full (addr, length, bcache, NULL); } /* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has @@ -219,9 +206,8 @@ bcache (const void *addr, int length, struct bcache *bcache) optional ADDED is not NULL, return 1 in case of new entry or 0 if returning an old entry. */ -void * -deprecated_bcache_added (const void *addr, int length, struct bcache *bcache, - int *added) +const void * +bcache_full (const void *addr, int length, struct bcache *bcache, int *added) { unsigned long full_hash; unsigned short half_hash; diff --git a/gdb/bcache.h b/gdb/bcache.h index a49d729..b56cf3b 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -145,13 +145,15 @@ struct bcache; either case, return a pointer to BCACHE's copy of that string. Since the cached value is ment to be read-only, return a const buffer. */ -extern void *deprecated_bcache (const void *addr, int length, - struct bcache *bcache); extern const void *bcache (const void *addr, int length, struct bcache *bcache); -extern void *deprecated_bcache_added (const void *addr, int length, - struct bcache *bcache, int *added); +/* Like bcache, but if ADDED is not NULL, set *ADDED to true if the + bytes were newly added to the cache, or to false if the bytes were + found in the cache. */ +extern const void *bcache_full (const void *addr, int length, + struct bcache *bcache, int *added); + /* Free all the storage used by BCACHE. */ extern void bcache_xfree (struct bcache *bcache); diff --git a/gdb/symfile.c b/gdb/symfile.c index 1825641..e0d94f3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3099,7 +3099,7 @@ start_psymtab_common (struct objfile *objfile, structure. In other words, having two symbols with the same name but different domain (or address) is possible and correct. */ -static struct partial_symbol * +static const struct partial_symbol * add_psymbol_to_bcache (char *name, int namelength, domain_enum domain, enum address_class class, long val, /* Value as a long */ @@ -3137,8 +3137,8 @@ add_psymbol_to_bcache (char *name, int namelength, domain_enum domain, SYMBOL_SET_NAMES (&psymbol, buf, namelength, objfile); /* Stash the partial symbol away in the cache */ - return deprecated_bcache_added (&psymbol, sizeof (struct partial_symbol), - objfile->psymbol_cache, added); + return bcache_full (&psymbol, sizeof (struct partial_symbol), + objfile->psymbol_cache, added); } /* Helper function, adds partial symbol to the given partial symbol @@ -3146,12 +3146,12 @@ add_psymbol_to_bcache (char *name, int namelength, domain_enum domain, static void append_psymbol_to_list (struct psymbol_allocation_list *list, - struct partial_symbol *psym, + const struct partial_symbol *psym, struct objfile *objfile) { if (list->next >= list->list + list->size) extend_psymbol_list (list, objfile); - *list->next++ = psym; + *list->next++ = (struct partial_symbol *) psym; OBJSTAT (objfile, n_psyms++); } @@ -3178,7 +3178,7 @@ add_psymbol_to_list (char *name, int namelength, domain_enum domain, CORE_ADDR coreaddr, /* Value as a CORE_ADDR */ enum language language, struct objfile *objfile) { - struct partial_symbol *psym; + const struct partial_symbol *psym; int added;