diff options
author | Alexander Larsson <alexl@redhat.com> | 2018-05-23 15:15:33 +0200 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2018-05-25 14:42:52 +0900 |
commit | c42402d0b8ada2472924619fc197a0394fbcd62c (patch) | |
tree | 8b5ca3dbb77f250751845914a87dac67d48cba9c /src/fcmatch.c | |
parent | a63b9c622e240ec0d8f9d83d286db1b55849f374 (diff) | |
download | fontconfig-c42402d0b8ada2472924619fc197a0394fbcd62c.tar.gz |
Cache: Rewrite relocated paths in earlier
This changes the rewriting of the FC_FILE values for relocated caches to an earlier stage
while reading the cache. This is better, because it means all APIs will report the
rewritten paths, not just the once that use the list apis.
We do this by detecting the relocated case and duplicating the FcPattern and FcPatternElm
in an cache allocation (which will die with the cache) and then reusing the FcValueLists
from the cache.
This means that in the rewritten case we will use some more memory, but not the full
size of the cache. In a test here I had 800k of relocated caches, but ~200k of wasted
on duplicating the objects.
This should fix https://bugs.freedesktop.org/show_bug.cgi?id=106618
Diffstat (limited to 'src/fcmatch.c')
-rw-r--r-- | src/fcmatch.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/fcmatch.c b/src/fcmatch.c index cfb278a..cab38ca 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -682,43 +682,9 @@ FcFontRenderPrepare (FcConfig *config, } else { - if (FcRefIsConst (&font->ref) && fe->object == FC_FILE_OBJECT) - { - FcValueListPtr l = FcPatternEltValues (fe); - FcChar8 *dir, *alias; - - while (l->value.type != FcTypeString) - l = FcValueListNext (l); - if (!l) - goto bail0; - dir = FcStrDirname (FcValueString (&l->value)); - if (!config) - config = FcConfigGetCurrent (); - if (config && FcHashTableFind (config->alias_table, dir, (void **) &alias)) - { - FcChar8 *base = FcStrBasename (FcValueString (&l->value)); - FcChar8 *s = FcStrBuildFilename (alias, base, NULL); - FcValue v; - - FcStrFree (alias); - FcStrFree (base); - v.type = FcTypeString; - v.u.s = s; - FcPatternObjectAddWithBinding (new, fe->object, - FcValueCanonicalize (&v), - l->binding, - FcTrue); - FcStrFree (s); - FcStrFree (dir); - goto bail0; - } - else - FcStrFree (dir); - } FcPatternObjectListAdd (new, fe->object, FcValueListDuplicate (FcPatternEltValues (fe)), FcTrue); - bail0:; } } for (i = 0; i < pat->num; i++) |