]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccfg.c
Make the perf guys hate me a bit less: hoist the directory-name
[fontconfig.git] / src / fccfg.c
index a14c6b5914e1e096e0fa7e320fab603497af2ebe..56c1a3e3d026c8fa096a8dfebaee2aeb6d9323cd 100644 (file)
@@ -139,11 +139,6 @@ bail0:
     return 0;
 }
 
-typedef struct _FcFileTime {
-    time_t  time;
-    FcBool  set;
-} FcFileTime;
-
 static FcFileTime
 FcConfigNewestFile (FcStrSet *files)
 {
@@ -166,6 +161,19 @@ FcConfigNewestFile (FcStrSet *files)
     return newest;
 }
 
+FcFileTime
+FcConfigModifiedTime (FcConfig *config)
+{
+    if (!config)
+    {
+       FcFileTime v = { 0, FcFalse };
+       config = FcConfigGetCurrent ();
+       if (!config)
+           return v;
+    }
+    return FcConfigNewestFile (config->configFiles);
+}
+
 FcBool
 FcConfigUptoDate (FcConfig *config)
 {
@@ -266,7 +274,7 @@ FcConfigBuildFonts (FcConfig *config)
         goto bail2;
 
     if (config->cache)
-       FcGlobalCacheLoad (cache, oldDirs, config->cache);
+       FcGlobalCacheLoad (cache, oldDirs, config->cache, config);
 
     cached_fonts = FcCacheRead(config, cache);
     if (!cached_fonts)
@@ -292,7 +300,7 @@ FcConfigBuildFonts (FcConfig *config)
         for (i = 0; i < oldDirs->num; i++)
         {
            if (FcDebug () & FC_DBG_FONTSET)
-               printf ("scan dir %s\n", dir);
+               printf ("scan dir %s\n", oldDirs->strs[i]);
            FcDirScanConfig (fonts, config->fontDirs, cache, 
                             config->blanks, oldDirs->strs[i], 
                              FcFalse, config);
@@ -300,7 +308,11 @@ FcConfigBuildFonts (FcConfig *config)
 
        for (i = 0; i < cached_fonts->nfont; i++)
        {
-           if (FcConfigAcceptFont (config, cached_fonts->fonts[i]))
+           FcChar8     *cfn; 
+           FcPatternGetString (cached_fonts->fonts[i], FC_FILE, 0, &cfn);
+
+           if (FcConfigAcceptFont (config, cached_fonts->fonts[i]) &&
+                (cfn && FcConfigAcceptFilename (config, cfn)))
                FcFontSetAdd (fonts, cached_fonts->fonts[i]);
 
            cached_fonts->fonts[i] = 0; /* prevent free in FcFontSetDestroy */
@@ -1083,7 +1095,6 @@ static FcValueList *
 FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
 {
     FcValueList        *l;
-    FcValueListPtr lp;
     
     if (!e)
        return 0;
@@ -1102,18 +1113,15 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
        l->next  = FcValueListPtrCreateDynamic(0);
     }
     l->binding = binding;
-    lp = FcValueListPtrCreateDynamic(l);
-    while (FcValueListPtrU(lp) && FcValueListPtrU(lp)->value.type == FcTypeVoid)
+    if (l->value.type == FcTypeVoid)
     {
-       FcValueListPtr  next = FcValueListPtrU(lp)->next;
+       FcValueList  *next = FcValueListPtrU(l->next);
 
-       if (lp.bank == FC_BANK_DYNAMIC)
-       {
-           FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
-           free (l);
-       }
-       lp = next;
+       FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
+       free (l);
+       l = next;
     }
+
     return l;
 }
 
@@ -1652,7 +1660,7 @@ FcConfigHome (void)
            home = getenv ("USERPROFILE");
 #endif
 
-       return home;
+       return (FcChar8 *) home;
     }
     return 0;
 }