24 fpc->
ht =
htCreate(sizeHint * 2, 0, 1, NULL, NULL);
25 assert(fpc->
ht != NULL);
63 const char *
dirName,
const char * baseName,
int scareMem)
68 const char * cleanDirName;
80 cdnl = strlen(cleanDirName);
82 if (*cleanDirName ==
'/') {
99 end = dir + strlen(dir);
100 if (end[-1] !=
'/') *end++ =
'/';
101 end =
stpncpy(end, cleanDirName,
sizeof(dir) - (end - dir));
104 end = dir + strlen(dir);
105 if (end[-1] !=
'/') *end++ =
'/';
115 if (cleanDirName == NULL)
return fp;
118 buf = strcpy(
alloca(cdnl + 1), cleanDirName);
122 if (buf[1] && end[-1] ==
'/') {
132 if (cacheHit != NULL) {
134 }
else if (!stat((*buf !=
'\0' ? buf :
"/"), &sb)) {
135 size_t nb =
sizeof(*fp.
entry) + (*buf !=
'\0' ? (end-buf) : 1) + 1;
140 dn +=
sizeof(*newEntry);
141 strcpy(dn, (*buf !=
'\0' ? buf :
"/"));
142 newEntry->
ino = (ino_t)sb.st_ino;
143 newEntry->
dev = (dev_t)sb.st_dev;
154 fp.
subDir = cleanDirName + (end - buf);
157 if (fp.
subDir[0] ==
'\0' ||
162 if (!scareMem && fp.
subDir != NULL)
174 while ((end > buf) && *end !=
'/') end--;
189 const char * baseName,
int scareMem)
191 return doLookup(cache, dirName, baseName, scareMem);
199 unsigned char ch =
'\0';
201 while (*chptr !=
'\0') ch ^= *chptr++;
203 h |= ((unsigned)ch) << 24;
210 int fpEqual(
const void * key1,
const void * key2)
229 const char ** baseNames,
const rpmuint32_t * dirIndexes,
234 for (i = 0; i < (unsigned) fileCount; i++) {
237 if (i > 0 && dirIndexes[i - 1] == dirIndexes[i]) {
242 fpList[i] =
doLookup(cache, dirNames[dirIndexes[i]], baseNames[i],
261 HE_s he_s = { .
tag = 0, .t = 0, .p = &he_p, .c = 0, .freeData = 0 };
263 const char ** baseNames;
264 const char ** dirNames;
271 baseNames = he_p.
argv;
278 dirNames = he_p.
argv;
281 dirIndexes = he_p.
ui32p;
283 fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
285 dirIndexes =
_free(dirIndexes);
286 dirNames =
_free(dirNames);
287 baseNames =
_free(baseNames);