From: Patrick Lam Date: Tue, 29 Nov 2005 06:23:00 +0000 (+0000) Subject: Make the perf guys hate me a bit less: hoist the directory-name X-Git-Tag: fc-2_3_93~15 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=9fad72abaf3da6f3e4a691a0e1a852f6a7353d56;p=fontconfig.git Make the perf guys hate me a bit less: hoist the directory-name FcConfigAcceptFont check for cached fonts up to directory cache read time, rather than running it for each font. --- diff --git a/ChangeLog b/ChangeLog index 0c577e4..39de7e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-11-29 Patrick Lam + * src/fccfg.c (FcConfigBuildFonts): + * src/fccache.c (FcCacheReadDirs): + + Make the perf guys hate me a bit less: hoist the directory-name + FcConfigAcceptFont check for cached fonts up to directory cache + read time, rather than running it for each font. + 2005-11-29 Patrick Lam * src/fccfg.c (FcConfigBuildFonts): * src/fcint.h: diff --git a/src/fccache.c b/src/fccache.c index 353bf65..00948c3 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -624,6 +624,9 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache, */ while ((dir = FcStrListNext (list))) { + if (!FcConfigAcceptFilename (config, dir)) + continue; + /* freed below */ file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1); if (!file) diff --git a/src/fccfg.c b/src/fccfg.c index 00510e5..56c1a3e 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -308,13 +308,11 @@ FcConfigBuildFonts (FcConfig *config) for (i = 0; i < cached_fonts->nfont; i++) { - FcChar8 *cfn, *cfd; + FcChar8 *cfn; FcPatternGetString (cached_fonts->fonts[i], FC_FILE, 0, &cfn); - cfd = (FcChar8 *)FcCacheFindBankDir (cached_fonts->fonts[i]->bank); if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) && - (cfn && FcConfigAcceptFilename (config, cfn)) && - (cfd && FcConfigAcceptFilename (config, cfd))) + (cfn && FcConfigAcceptFilename (config, cfn))) FcFontSetAdd (fonts, cached_fonts->fonts[i]); cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */