18 fpc->
ht =
htCreate(sizeHint * 2, 0, 1, NULL, NULL);
59 const char *
dirName,
const char * baseName,
int scareMem)
63 const char * cleanDirName;
75 cdnl = strlen(cleanDirName);
77 if (*cleanDirName ==
'/') {
97 end = dir + strlen(dir);
98 if (end[-1] !=
'/') *end++ =
'/';
99 end =
stpncpy(end, cleanDirName,
sizeof(dir) - (end - dir));
102 end = dir + strlen(dir);
103 if (end[-1] !=
'/') *end++ =
'/';
114 if (cleanDirName == NULL)
return fp;
117 buf = strcpy(
alloca(cdnl + 1), cleanDirName);
121 if (buf[1] && end[-1] ==
'/') {
131 if (cacheHit != NULL) {
133 }
else if (!stat((*buf !=
'\0' ? buf :
"/"), &sb)) {
134 size_t nb =
sizeof(*fp.
entry) + (*buf !=
'\0' ? (end-buf) : 1) + 1;
139 dn +=
sizeof(*newEntry);
140 strcpy(dn, (*buf !=
'\0' ? buf :
"/"));
141 newEntry->
ino = sb.st_ino;
142 newEntry->
dev = sb.st_dev;
153 fp.
subDir = cleanDirName + (end - buf);
156 if (fp.
subDir[0] ==
'\0' ||
161 if (!scareMem && fp.
subDir != NULL)
173 while ((end > buf) && *end !=
'/') end--;
189 const char * baseName,
int scareMem)
191 return doLookup(cache, dirName, baseName, scareMem);
198 unsigned char ch = 0;
201 while (*chptr !=
'\0') ch ^= *chptr++;
204 h |= ((unsigned)ch) << 24;
212 int fpEqual(
const void * key1,
const void * key2)
233 const char ** baseNames,
const uint_32 * dirIndexes,
238 for (i = 0; i < fileCount; i++) {
241 if (i > 0 && dirIndexes[i - 1] == dirIndexes[i]) {
246 fpList[i] =
doLookup(cache, dirNames[dirIndexes[i]], baseNames[i],
267 const char ** baseNames, ** dirNames;
278 fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
279 dirNames = hfd(dirNames, dnt);
280 baseNames = hfd(baseNames, bnt);