Bugzilla – Attachment 67086 Details for
Bug 148361
fontconfig: still statting world ...
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
A patch to add validatecache config option
fc-validatecache-option.diff (text/plain), 4.02 KB, created by
Takashi Iwai
on 2006-02-08 20:50:42 UTC
(
hide
)
Description:
A patch to add validatecache config option
Filename:
MIME Type:
Creator:
Takashi Iwai
Created:
2006-02-08 20:50:42 UTC
Size:
4.02 KB
patch
obsolete
>--- src/fcint.h-dist 2006-02-08 20:57:29.000000000 +0100 >+++ src/fcint.h 2006-02-08 20:58:06.000000000 +0100 >@@ -414,6 +414,10 @@ struct _FcConfig { > */ > time_t rescanTime; /* last time information was scanned */ > int rescanInterval; /* interval between scans */ >+ /* >+ * Validate cache files at each open? >+ */ >+ FcBool validateCache; > }; > > extern FcConfig *_fcConfig; >--- src/fccfg.c-dist 2006-02-08 21:07:16.000000000 +0100 >+++ src/fccfg.c 2006-02-08 21:07:38.000000000 +0100 >@@ -117,6 +117,7 @@ FcConfigCreate (void) > > config->rescanTime = time(0); > config->rescanInterval = 30; >+ config->validateCache = 1; > > return config; > >--- src/fcxml.c-dist 2006-02-08 20:55:00.000000000 +0100 >+++ src/fcxml.c 2006-02-08 20:57:18.000000000 +0100 >@@ -293,6 +293,7 @@ typedef enum _FcElement { > > FcElementBlank, > FcElementRescan, >+ FcElementValidatecache, > > FcElementPrefer, > FcElementAccept, >@@ -353,6 +354,7 @@ static struct { > > { "blank", FcElementBlank }, > { "rescan", FcElementRescan }, >+ { "validatecache", FcElementValidatecache }, > > { "prefer", FcElementPrefer }, > { "accept", FcElementAccept }, >@@ -1099,6 +1101,20 @@ FcParseRescan (FcConfigParse *parse) > } > > static void >+FcParseValidatecache (FcConfigParse *parse) >+{ >+ int n = FcVStackElements (parse); >+ while (n-- > 0) >+ { >+ FcVStack *v = FcVStackFetch (parse, n); >+ if (v->tag != FcVStackBool) >+ FcConfigMessage (parse, FcSevereWarning, "non-boolean validatecache"); >+ else >+ parse->config->validateCache = v->u.bool; >+ } >+} >+ >+static void > FcParseInt (FcConfigParse *parse) > { > FcChar8 *s, *end; >@@ -2086,6 +2102,9 @@ FcEndElement(void *userData, const XML_C > case FcElementRescan: > FcParseRescan (parse); > break; >+ case FcElementValidatecache: >+ FcParseValidatecache (parse); >+ break; > > case FcElementPrefer: > FcParseFamilies (parse, FcVStackPrefer); >--- src/fccache.c-dist 2006-02-08 20:58:21.000000000 +0100 >+++ src/fccache.c 2006-02-08 21:38:23.000000000 +0100 >@@ -221,9 +221,10 @@ FcGlobalCacheLoad (FcGlobalCache *cac > > /* Directory must be older than the global cache file; also > cache must be newer than the config file. */ >- if (stat ((char *) name_buf, &dir_stat) < 0 || >- dir_stat.st_mtime > cache_stat.st_mtime || >- (config_time.set && cache_stat.st_mtime < config_time.time)) >+ if (config->validateCache && >+ (stat ((char *) name_buf, &dir_stat) < 0 || >+ dir_stat.st_mtime > cache_stat.st_mtime || >+ (config_time.set && cache_stat.st_mtime < config_time.time))) > { > FcCache md; > off_t off; >@@ -876,6 +877,27 @@ FcCacheReadDirs (FcConfig * config, FcGl > continue; > } > >+ if (! config->validateCache) >+ { >+ /* We trust cache files -- if not found, just ignore that directory >+ */ >+ if ((cache && FcGlobalCacheReadDir (set, subdirs, cache, (char *)dir, >+ config)) || >+ FcDirCacheRead (set, subdirs, dir, config)) >+ { >+ sublist = FcStrListCreate (subdirs); >+ FcStrSetDestroy (subdirs); >+ if (!sublist) >+ { >+ fprintf (stderr, "Can't create subdir list in \"%s\"\n", dir); >+ ret++; >+ continue; >+ } >+ ret += FcCacheReadDirs (config, cache, sublist, set, processed_dirs); >+ } >+ continue; >+ } >+ > if (access ((char *) dir, X_OK) < 0) > { > switch (errno) { >--- fonts.dtd-dist 2006-02-08 21:12:11.000000000 +0100 >+++ fonts.dtd 2006-02-08 21:14:00.000000000 +0100 >@@ -40,7 +40,7 @@ > <!-- > Global library configuration data > --> >-<!ELEMENT config (blank|rescan)*> >+<!ELEMENT config (blank|rescan|validatecache)*> > > <!-- > Specify the set of Unicode encoding values which >@@ -82,6 +82,13 @@ > <!ELEMENT rescan (int)> > > <!-- >+ Validate cache files dynamically >+ If this is set to false, fontconfig trusts cache files and never >+ checks the timestamp or changes of contents. >+ --> >+<!ELEMENT validatecache (bool)> >+ >+<!-- > Edit list of available fonts at startup/reload time > --> > <!ELEMENT selectfont (rejectfont | acceptfont)* >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 148361
: 67086