re PR java/24120 (jc1 incorrectly uses libiberty hashes)

PR java/24120:
	* jcf-io.c (memoized_dirlist_hash): New function.
	(caching_stat): Use it.

From-SVN: r104809
This commit is contained in:
Tom Tromey 2005-09-30 00:33:26 +00:00 committed by Tom Tromey
parent edbcf8fd55
commit 07f0879956
2 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2005-09-29 Tom Tromey <tromey@redhat.com>
PR java/24120:
* jcf-io.c (memoized_dirlist_hash): New function.
(caching_stat): Use it.
2005-09-21 Ranjit Mathew <rmathew@gcc.gnu.org>
PR java/21418

View file

@ -311,6 +311,14 @@ typedef struct memoized_dirlist_entry
struct dirent **files;
} memoized_dirlist_entry;
/* A hash function for a memoized_dirlist_entry. */
static hashval_t
memoized_dirlist_hash (const void *entry)
{
const memoized_dirlist_entry *mde = (const memoized_dirlist_entry *) entry;
return htab_hash_string (mde->dir);
}
/* Returns true if ENTRY (a memoized_dirlist_entry *) corresponds to
the directory given by KEY (a char *) giving the directory
name. */
@ -341,11 +349,12 @@ caching_stat (char *filename, struct stat *buf)
char *base;
memoized_dirlist_entry *dent;
void **slot;
struct memoized_dirlist_entry temp;
/* If the hashtable has not already been created, create it now. */
if (!memoized_dirlists)
memoized_dirlists = htab_create (37,
htab_hash_string,
memoized_dirlist_hash,
memoized_dirlist_lookup_eq,
NULL);
@ -364,8 +373,13 @@ caching_stat (char *filename, struct stat *buf)
else
base = filename;
/* Obtain the entry for this directory from the hash table. */
slot = htab_find_slot (memoized_dirlists, filename, INSERT);
/* Obtain the entry for this directory from the hash table. This
approach is ok since we know that the hash function only looks at
the directory name. */
temp.dir = filename;
temp.num_files = 0;
temp.files = NULL;
slot = htab_find_slot (memoized_dirlists, &temp, INSERT);
if (!*slot)
{
/* We have not already scanned this directory; scan it now. */