Eliminate need to reference cache object once per cached font, instead
just count the number of fonts used from the cache and bump the reference
count once by that amount. I think this makes this refernece technique
efficient enough for use.
return cache;
}
+void
+FcDirCacheReference (FcCache *cache, int nref)
+{
+ FcCacheSkip *skip = FcCacheFindByAddr (cache);
+
+ if (skip)
+ skip->ref += nref;
+}
+
void
FcDirCacheUnload (FcCache *cache)
{
fs = FcCacheSet (cache);
if (fs)
{
+ int nref = 0;
+
for (i = 0; i < fs->nfont; i++)
{
FcPattern *font = FcFontSetFont (fs, i);
if (!FcConfigAcceptFont (config, font))
continue;
- FcPatternReference (font);
+ nref++;
FcFontSetAdd (config->fonts[FcSetSystem], font);
}
+ FcDirCacheReference (cache, nref);
}
/*
FcPrivate void
FcCacheFini (void);
+void
+FcDirCacheReference (FcCache *cache, int nref);
+
/* fccfg.c */
FcPrivate FcBool