]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccfg.c
Update architecture signatures for x86-64 and ppc.
[fontconfig.git] / src / fccfg.c
index cec0e4a795b2d6b82ce0989a6b0b1cff4e20ad98..01d381c5f33ea118ad42adf3c8c4cc3b937065e8 100644 (file)
@@ -85,12 +85,11 @@ FcConfigCreate (void)
 
     config->substPattern = 0;
     config->substFont = 0;
+    config->substScan = 0;
     config->maxObjects = 0;
     for (set = FcSetSystem; set <= FcSetApplication; set++)
        config->fonts[set] = 0;
 
-    config->caches = NULL;
-
     config->rescanTime = time(0);
     config->rescanInterval = 30;    
     
@@ -196,7 +195,6 @@ void
 FcConfigDestroy (FcConfig *config)
 {
     FcSetName  set;
-    FcCacheList        *cl, *cl_next;
 
     if (config == _fcConfig)
        _fcConfig = 0;
@@ -215,17 +213,11 @@ FcConfigDestroy (FcConfig *config)
 
     FcSubstDestroy (config->substPattern);
     FcSubstDestroy (config->substFont);
+    FcSubstDestroy (config->substScan);
     for (set = FcSetSystem; set <= FcSetApplication; set++)
        if (config->fonts[set])
            FcFontSetDestroy (config->fonts[set]);
 
-    for (cl = config->caches; cl; cl = cl_next)
-    {
-       cl_next = cl->next;
-       FcDirCacheUnload (cl->cache);
-       free (cl);
-    }
-
     free (config);
     FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
 }
@@ -237,26 +229,18 @@ FcConfigDestroy (FcConfig *config)
 FcBool
 FcConfigAddCache (FcConfig *config, FcCache *cache)
 {
-    FcCacheList        *cl = malloc (sizeof (FcCacheList));
     FcFontSet  *fs;
     intptr_t   *dirs;
     int                i;
 
-    /*
-     * Add to cache list
-     */
-    if (!cl)
-       return FcFalse;
-    cl->cache = cache;
-    cl->next = config->caches;
-    config->caches = cl;
-
     /*
      * Add fonts
      */
     fs = FcCacheSet (cache);
     if (fs)
     {
+       int     nref = 0;
+       
        for (i = 0; i < fs->nfont; i++)
        {
            FcPattern   *font = FcFontSetFont (fs, i);
@@ -278,8 +262,10 @@ FcConfigAddCache (FcConfig *config, FcCache *cache)
            if (!FcConfigAcceptFont (config, font))
                continue;
                
+           nref++;
            FcFontSetAdd (config->fonts[FcSetSystem], font);
        }
+       FcDirCacheReference (cache, nref);
     }
 
     /*
@@ -336,6 +322,7 @@ FcConfigBuildFonts (FcConfig *config)
        if (!cache)
            continue;
        FcConfigAddCache (config, cache);
+       FcDirCacheUnload (cache);
     }
     
     FcStrListDone (dirlist);
@@ -561,14 +548,23 @@ FcConfigAddEdit (FcConfig *config,
     FcTest     *t;
     int                num;
 
+    switch (kind) {
+    case FcMatchPattern:
+       prev = &config->substPattern;
+       break;
+    case FcMatchFont:
+       prev = &config->substFont;
+       break;
+    case FcMatchScan:
+       prev = &config->substScan;
+       break;
+    default:
+       return FcFalse;
+    }
     subst = (FcSubst *) malloc (sizeof (FcSubst));
     if (!subst)
        return FcFalse;
     FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
-    if (kind == FcMatchPattern)
-       prev = &config->substPattern;
-    else
-       prev = &config->substFont;
     for (; *prev; prev = &(*prev)->next);
     *prev = subst;
     subst->next = 0;
@@ -1290,6 +1286,20 @@ FcConfigSubstituteWithPat (FcConfig    *config,
            return FcFalse;
     }
 
+    switch (kind) {
+    case FcMatchPattern:
+       s = config->substPattern;
+       break;
+    case FcMatchFont:
+       s = config->substFont;
+       break;
+    case FcMatchScan:
+       s = config->substScan;
+       break;
+    default:
+       return FcFalse;
+    }
+
     st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
     if (!st && config->maxObjects)
        return FcFalse;
@@ -1300,10 +1310,6 @@ FcConfigSubstituteWithPat (FcConfig    *config,
        printf ("FcConfigSubstitute ");
        FcPatternPrint (p);
     }
-    if (kind == FcMatchPattern)
-       s = config->substPattern;
-    else
-       s = config->substFont;
     for (; s; s = s->next)
     {
        /*
@@ -1958,3 +1964,6 @@ FcConfigAcceptFont (FcConfig          *config,
        return FcFalse;
     return FcTrue;
 }
+#define __fccfg__
+#include "fcaliastail.h"
+#undef __fccfg__