Commit 2eb84374 authored by Patrick Lam's avatar Patrick Lam
Browse files

When fc-cache is run without --force, use directory cache files to speed up

    fc-cache run time.
parent 23787a8f
...@@ -46,7 +46,7 @@ FcDirCacheProduce (FcFontSet *set, FcCache * metadata); ...@@ -46,7 +46,7 @@ FcDirCacheProduce (FcFontSet *set, FcCache * metadata);
static FcBool static FcBool
FcDirCacheConsume (int fd, FcFontSet *set); FcDirCacheConsume (int fd, FcFontSet *set);
static FcBool FcBool
FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir); FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir);
static int static int
...@@ -690,7 +690,7 @@ FcCacheRead (FcConfig *config, FcGlobalCache * cache) ...@@ -690,7 +690,7 @@ FcCacheRead (FcConfig *config, FcGlobalCache * cache)
} }
/* read serialized state from the cache file */ /* read serialized state from the cache file */
static FcBool FcBool
FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir) FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir)
{ {
char *cache_file = (char *)FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE); char *cache_file = (char *)FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
......
...@@ -138,6 +138,9 @@ FcDirScanConfig (FcFontSet *set, ...@@ -138,6 +138,9 @@ FcDirScanConfig (FcFontSet *set,
*/ */
if (cache && FcGlobalCacheReadDir (set, dirs, cache, (char *)dir, config)) if (cache && FcGlobalCacheReadDir (set, dirs, cache, (char *)dir, config))
return FcTrue; return FcTrue;
if (FcDirCacheRead (set, dirs, dir))
return FcTrue;
} }
/* freed below */ /* freed below */
......
...@@ -445,6 +445,9 @@ FcCacheRead (FcConfig *config, FcGlobalCache * cache); ...@@ -445,6 +445,9 @@ FcCacheRead (FcConfig *config, FcGlobalCache * cache);
FcBool FcBool
FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir); FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
FcBool
FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir);
int int
FcCacheBankToIndex (int bank); FcCacheBankToIndex (int bank);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment