Changeset 1853 for trunk/src/kmk/read.c
- Timestamp:
- Oct 13, 2008, 3:46:35 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/read.c
r1846 r1853 2124 2124 2125 2125 /* Remove duplicate dependencies in CHAIN. */ 2126 #ifndef CONFIG_WITH_VALUE_LENGTH 2126 2127 2127 2128 static unsigned long … … 2154 2155 } 2155 2156 2157 #else /* CONFIG_WITH_VALUE_LENGTH */ 2158 2159 /* Exploit the fact that all names are in the string cache. This means equal 2160 names shall have the same storage and there is no need for hashing or 2161 comparing. Use the address as the first hash, avoiding any touching of 2162 the name, and the length as the second. */ 2163 2164 static unsigned long 2165 dep_hash_1 (const void *key) 2166 { 2167 const char *name = dep_name ((struct dep const *) key); 2168 assert (strcache_iscached (name)); 2169 return (size_t) name / sizeof(void *); 2170 } 2171 2172 static unsigned long 2173 dep_hash_2 (const void *key) 2174 { 2175 const char *name = dep_name ((struct dep const *) key); 2176 return strcache_get_len (name); 2177 } 2178 2179 static int 2180 dep_hash_cmp (const void *x, const void *y) 2181 { 2182 struct dep *dx = (struct dep *) x; 2183 struct dep *dy = (struct dep *) y; 2184 const char *dxname = dep_name (dx); 2185 const char *dyname = dep_name (dy); 2186 int cmp = dxname == dyname ? 0 : 1; 2187 2188 /* check preconds: both cached and the cache contains no duplicates. */ 2189 assert (strcache_iscached (dxname)); 2190 assert (strcache_iscached (dyname)); 2191 assert (cmp == 0 || strcmp (dxname, dyname) != 0); 2192 2193 /* If the names are the same but ignore_mtimes are not equal, one of these 2194 is an order-only prerequisite and one isn't. That means that we should 2195 remove the one that isn't and keep the one that is. */ 2196 2197 if (!cmp && dx->ignore_mtime != dy->ignore_mtime) 2198 dx->ignore_mtime = dy->ignore_mtime = 0; 2199 2200 return cmp; 2201 } 2202 2203 #endif /* CONFIG_WITH_VALUE_LENGTH */ 2156 2204 2157 2205 void … … 2467 2515 /* Single-colon. Combine these dependencies 2468 2516 with others in file's existing record, if any. */ 2517 #ifndef KMK 2469 2518 f = enter_file (strcache_add (name)); 2519 #else /* KMK - the name is already in the cache, don't waste time. */ 2520 f = enter_file (name); 2521 #endif 2470 2522 2471 2523 if (f->double_colon)
Note:
See TracChangeset
for help on using the changeset viewer.