Revert "Workaround another race condition issue"

This reverts commit f44bfad235.
This commit is contained in:
Akira TAGOH 2016-04-06 14:39:15 +09:00
parent d05d083e9f
commit d179cbc253
3 changed files with 8 additions and 62 deletions

View File

@ -587,33 +587,6 @@ FcCacheTimeValid (FcConfig *config, FcCache *cache, struct stat *dir_stat)
return cache->checksum == (int) dir_stat->st_mtime && fnano;
}
static FcBool
FcCacheDirsValid (FcConfig *config, FcCache *cache)
{
FcStrSet *dirs = FcStrSetCreateEx (FCSS_GROW_BY_64);
FcBool ret = FcFalse;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
FcChar8 *d;
if (!dirs)
goto bail;
if (sysroot)
d = FcStrBuildFilename (sysroot, FcCacheDir (cache), NULL);
else
d = FcStrdup (FcCacheDir (cache));
if (!FcDirScanOnly (dirs, d, config))
goto bail1;
ret = cache->dirs_count == dirs->num;
if (FcDebug () & FC_DBG_CACHE)
printf ("%s: cache: %d, fs: %d\n", d, cache->dirs_count, dirs->num);
bail1:
FcStrSetDestroy (dirs);
FcStrFree (d);
bail:
return ret;
}
/*
* Map a cache file into memory
*/
@ -628,8 +601,7 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
cache = FcCacheFindByStat (fd_stat);
if (cache)
{
if (FcCacheTimeValid (config, cache, dir_stat) &&
FcCacheDirsValid (config, cache))
if (FcCacheTimeValid (config, cache, dir_stat))
return cache;
FcDirCacheUnload (cache);
cache = NULL;
@ -681,7 +653,6 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
cache->version < FC_CACHE_VERSION_NUMBER ||
cache->size != (intptr_t) fd_stat->st_size ||
!FcCacheTimeValid (config, cache, dir_stat) ||
!FcCacheDirsValid (config, cache) ||
!FcCacheInsert (cache, fd_stat))
{
if (allocated)

View File

@ -233,8 +233,7 @@ FcDirScanConfig (FcFontSet *set,
FcBlanks *blanks,
const FcChar8 *dir,
FcBool force, /* XXX unused */
FcConfig *config,
FcBool scanOnly)
FcConfig *config)
{
DIR *d;
struct dirent *e;
@ -250,7 +249,7 @@ FcDirScanConfig (FcFontSet *set,
if (!set && !dirs)
return FcTrue;
if (!blanks && !scanOnly)
if (!blanks)
blanks = FcConfigGetBlanks (config);
/* freed below */
@ -303,17 +302,7 @@ FcDirScanConfig (FcFontSet *set,
* Scan file files to build font patterns
*/
for (i = 0; i < files->num; i++)
{
if (scanOnly)
{
if (FcFileIsDir (files->strs[i]))
FcFileScanConfig (NULL, dirs, NULL, files->strs[i], config);
}
else
{
FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
}
}
FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
bail2:
FcStrSetDestroy (files);
@ -337,15 +326,7 @@ FcDirScan (FcFontSet *set,
if (cache || !force)
return FcFalse;
return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent (), FcFalse);
}
FcBool
FcDirScanOnly (FcStrSet *dirs,
const FcChar8 *dir,
FcConfig *config)
{
return FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config, FcTrue);
return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent ());
}
/*
@ -385,7 +366,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
/*
* Scan the dir
*/
if (!FcDirScanConfig (set, dirs, NULL, d, FcTrue, config, FcFalse))
if (!FcDirScanConfig (set, dirs, NULL, d, FcTrue, config))
goto bail2;
/*
@ -440,7 +421,7 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
/*
* Scan the dir
*/
if (!FcDirScanConfig (NULL, dirs, NULL, d, FcTrue, config, FcFalse))
if (!FcDirScanConfig (NULL, dirs, NULL, d, FcTrue, config))
goto bail1;
/*
* Rebuild the cache object

View File

@ -851,13 +851,7 @@ FcDirScanConfig (FcFontSet *set,
FcBlanks *blanks,
const FcChar8 *dir,
FcBool force,
FcConfig *config,
FcBool scanOnly);
FcPrivate FcBool
FcDirScanOnly (FcStrSet *dirs,
const FcChar8 *dir,
FcConfig *config);
FcConfig *config);
/* fcfont.c */
FcPrivate int