Index: /trunk/src/kmk/dir.c
===================================================================
--- /trunk/src/kmk/dir.c	(revision 1890)
+++ /trunk/src/kmk/dir.c	(revision 1891)
@@ -231,5 +231,9 @@
      * qualified name of the directory. Beware though, this is also
      * unreliable. I'm open to suggestion on a better way to emulate inode.  */
+# ifndef CONFIG_WITH_STRCACHE2
     char *path_key;
+# else
+    char const *path_key; /* strcache'ed */
+# endif
     int   ctime;
     int   mtime;        /* controls check for stale directory cache */
@@ -256,6 +260,10 @@
 
 #ifdef WINDOWS32
+# ifndef CONFIG_WITH_STRCACHE2
   hash = 0;
   ISTRING_HASH_1 (key->path_key, hash);
+# else  /* CONFIG_WITH_STRCACHE2 */
+  hash = strcache_get_hash1 (key->path_key);
+# endif /* CONFIG_WITH_STRCACHE2 */
   hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) key->ctime;
 #else
@@ -279,6 +287,10 @@
 
 #ifdef WINDOWS32
+# ifndef CONFIG_WITH_STRCACHE2
   hash = 0;
   ISTRING_HASH_2 (key->path_key, hash);
+# else  /* CONFIG_WITH_STRCACHE2 */
+  hash = strcache_get_hash2 (key->path_key);
+# endif /* CONFIG_WITH_STRCACHE2 */
   hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime;
 #else
@@ -315,7 +327,12 @@
 
 #ifdef WINDOWS32
+# ifndef CONFIG_WITH_STRCACHE2
   ISTRING_COMPARE (x->path_key, y->path_key, result);
   if (result)
     return result;
+# else  /* CONFIG_WITH_STRCACHE2 */
+  if (x->path_key != y->path_key)
+    return -1;
+# endif /* CONFIG_WITH_STRCACHE2 */
   result = MAKECMP(x->ctime, y->ctime);
   if (result)
@@ -363,5 +380,9 @@
 directory_hash_1 (const void *key)
 {
+#ifndef CONFIG_WITH_STRCACHE2
   return_ISTRING_HASH_1 (((const struct directory *) key)->name);
+#else
+  return strcache_get_hash1 (((const struct directory *) key)->name);
+#endif
 }
 
@@ -369,5 +390,9 @@
 directory_hash_2 (const void *key)
 {
+#ifndef CONFIG_WITH_STRCACHE2
   return_ISTRING_HASH_2 (((const struct directory *) key)->name);
+#else
+  return strcache_get_hash2 (((const struct directory *) key)->name);
+#endif
 }
 
@@ -375,6 +400,11 @@
 directory_hash_cmp (const void *x, const void *y)
 {
+#ifndef CONFIG_WITH_STRCACHE2
   return_ISTRING_COMPARE (((const struct directory *) x)->name,
 			  ((const struct directory *) y)->name);
+#else
+  return ((const struct directory *) x)->name
+      == ((const struct directory *) y)->name ? 0 : -1;
+#endif
 }
 
@@ -406,5 +436,9 @@
 dirfile_hash_1 (const void *key)
 {
+#ifndef CONFIG_WITH_STRCACHE2
   return_ISTRING_HASH_1 (((struct dirfile const *) key)->name);
+#else
+  return strcache_get_hash1 (((struct dirfile const *) key)->name);
+#endif
 }
 
@@ -412,5 +446,9 @@
 dirfile_hash_2 (const void *key)
 {
+#ifndef CONFIG_WITH_STRCACHE2
   return_ISTRING_HASH_2 (((struct dirfile const *) key)->name);
+#else
+  return strcache_get_hash2 (((struct dirfile const *) key)->name);
+#endif
 }
 
@@ -420,8 +458,12 @@
   const struct dirfile *x = xv;
   const struct dirfile *y = yv;
+#ifndef CONFIG_WITH_STRCACHE2
   int result = x->length - y->length;
   if (result)
     return result;
   return_ISTRING_COMPARE (x->name, y->name);
+#else
+  return x->name == y->name ? 0 : -1;
+#endif
 }
 
@@ -466,5 +508,10 @@
 #endif
 
+#ifndef CONFIG_WITH_STRCACHE2
   dir_key.name = name;
+#else
+  p = name + strlen (name);
+  dir_key.name = strcache_add_len (name, p - name);
+#endif
   dir_slot = (struct directory **) hash_find_slot (&directories, &dir_key);
   dir = *dir_slot;
@@ -476,5 +523,7 @@
       /* The directory was not found.  Create a new entry for it.  */
 
+#ifndef CONFIG_WITH_STRCACHE2
       p = name + strlen (name);
+#endif
 #ifndef CONFIG_WITH_ALLOC_CACHES
       dir = xmalloc (sizeof (struct directory));
@@ -482,5 +531,9 @@
       dir = alloccache_alloc (&directories_cache);
 #endif
+#ifndef CONFIG_WITH_STRCACHE2
       dir->name = strcache_add_len (name, p - name);
+#else
+      dir->name = dir_key.name;
+#endif
       hash_insert_at (&directories, dir, dir_slot);
       /* The directory is not in the name hash table.
@@ -523,5 +576,10 @@
 	  dc_key.dev = st.st_dev;
 #ifdef WINDOWS32
+# ifndef CONFIG_WITH_STRCACHE2
 	  dc_key.path_key = w32_path = w32ify (name, 1);
+# else  /* CONFIG_WITH_STRCACHE2 */
+	  w32_path = w32ify (name, 1);
+	  dc_key.path_key = strcache_add (w32_path);
+# endif /* CONFIG_WITH_STRCACHE2 */
 	  dc_key.ctime = st.st_ctime;
 #else
@@ -552,5 +610,10 @@
 	      dc->dev = st.st_dev;
 #ifdef WINDOWS32
+# ifndef CONFIG_WITH_STRCACHE2
               dc->path_key = xstrdup (w32_path);
+# else  /* CONFIG_WITH_STRCACHE2 */
+              dc->path_key = dc_key.path_key;
+# endif /* CONFIG_WITH_STRCACHE2 */
+
 	      dc->ctime = st.st_ctime;
               dc->mtime = st.st_mtime;
@@ -664,6 +727,12 @@
 	  return 1;
 	}
+#ifndef CONFIG_WITH_STRCACHE2
       dirfile_key.name = filename;
       dirfile_key.length = strlen (filename);
+#else  /* CONFIG_WITH_STRCACHE2 */
+      dirfile_key.length = strlen (filename);
+      dirfile_key.name = filename
+        = strcache_add_len (filename, dirfile_key.length);
+#endif /* CONFIG_WITH_STRCACHE2 */
       df = hash_find_item (&dir->dirfiles, &dirfile_key);
       if (df)
@@ -758,5 +827,9 @@
 
       len = NAMLEN (d);
+#ifndef CONFIG_WITH_STRCACHE2
       dirfile_key.name = d->d_name;
+#else
+      dirfile_key.name = strcache_add_len (d->d_name, len);
+#endif
       dirfile_key.length = len;
       dirfile_slot = (struct dirfile **) hash_find_slot (&dir->dirfiles, &dirfile_key);
@@ -774,5 +847,9 @@
 	  df = alloccache_alloc (&dirfile_cache);
 #endif
+#ifndef CONFIG_WITH_STRCACHE2
 	  df->name = strcache_add_len (d->d_name, len);
+#else
+	  df->name = dirfile_key.name;
+#endif
 	  df->length = len;
 	  df->impossible = 0;
@@ -780,5 +857,9 @@
 	}
       /* Check if the name matches the one we're searching for.  */
+#ifndef CONFIG_WITH_STRCACHE2
       if (filename != 0 && strieq (d->d_name, filename))
+#else
+      if (filename != 0 && dirfile_key.name == filename)
+#endif
         return 1;
     }
@@ -1038,6 +1119,11 @@
 #endif
 
+#ifndef CONFIG_WITH_STRCACHE2
   dirfile_key.name = filename;
   dirfile_key.length = strlen (filename);
+#else
+  dirfile_key.length = strlen (filename);
+  dirfile_key.name = strcache_add_len (filename, dirfile_key.length);
+#endif
   dirfile = hash_find_item (&dir->dirfiles, &dirfile_key);
   if (dirfile)
