* jcf-io.c (memoized_dirlist_hash): New function.
(caching_stat): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104809
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
2005-09-21 Ranjit Mathew <rmathew@gcc.gnu.org>
PR java/21418
struct dirent **files;
} 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. */
/* Returns true if ENTRY (a memoized_dirlist_entry *) corresponds to
the directory given by KEY (a char *) giving the directory
name. */
char *base;
memoized_dirlist_entry *dent;
void **slot;
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,
/* If the hashtable has not already been created, create it now. */
if (!memoized_dirlists)
memoized_dirlists = htab_create (37,
memoized_dirlist_lookup_eq,
NULL);
memoized_dirlist_lookup_eq,
NULL);
- /* 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. */
if (!*slot)
{
/* We have not already scanned this directory; scan it now. */