]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccharset.c
Remove unneeded call to access(2) in fc-cache.
[fontconfig.git] / src / fccharset.c
index 43aa22c46d873ccc55288047a222db1dba07bd3d..5da131283d07f17991fbe361c239511282dd9a61 100644 (file)
@@ -43,9 +43,6 @@ FcCharSetCreate (void)
     return fcs;
 }
 
-FcCharSet *
-FcCharSetNew (void);
-    
 FcCharSet *
 FcCharSetNew (void)
 {
@@ -58,7 +55,10 @@ FcCharSetDestroy (FcCharSet *fcs)
     int i;
     
     if (fcs->ref == FC_REF_CONSTANT)
+    {
+       FcCacheObjectDereference (fcs);
        return;
+    }
     if (--fcs->ref > 0)
        return;
     for (i = 0; i < fcs->num; i++)
@@ -309,6 +309,8 @@ FcCharSetCopy (FcCharSet *src)
 {
     if (src->ref != FC_REF_CONSTANT)
        src->ref++;
+    else
+       FcCacheObjectReference (src);
     return src;
 }
 
@@ -693,8 +695,6 @@ FcCharSetFirstPage (const FcCharSet *a,
 /*
  * old coverage API, rather hard to use correctly
  */
-FcChar32
-FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
     
 FcChar32
 FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result)
@@ -1064,8 +1064,8 @@ FcCharSetHash (FcCharSet *fcs)
     int                i;
 
     /* hash in leaves */
-    for (i = 0; i < fcs->num * (int) (sizeof (FcCharLeaf *) / sizeof (FcChar32)); i++)
-       hash = ((hash << 1) | (hash >> 31)) ^ (FcChar32)(FcCharSetLeaf(fcs, i)->map);
+    for (i = 0; i < fcs->num; i++)
+       hash = ((hash << 1) | (hash >> 31)) ^ FcCharLeafHash (FcCharSetLeaf(fcs,i));
     /* hash in numbers */
     for (i = 0; i < fcs->num; i++)
        hash = ((hash << 1) | (hash >> 31)) ^ *FcCharSetNumbers(fcs);
@@ -1169,7 +1169,7 @@ FcCharSetFindFrozen (FcCharSetFreezer *freezer, const FcCharSet *orig)
     return NULL;
 }
 
-static const FcCharSet *
+const FcCharSet *
 FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
 {
     FcCharSet      *b;
@@ -1177,10 +1177,6 @@ FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
     FcCharLeaf     *l;
     int                    i;
 
-    n = FcCharSetFindFrozen (freezer, fcs);
-    if (n)
-       return n;
-    
     b = FcCharSetCreate ();
     if (!b)
        goto bail0;
@@ -1217,7 +1213,7 @@ bail0:
     return n;
 }
 
-static FcCharSetFreezer *
+FcCharSetFreezer *
 FcCharSetFreezerCreate (void)
 {
     FcCharSetFreezer   *freezer;
@@ -1279,6 +1275,9 @@ FcCharSetSerializeAlloc (FcSerialize *serialize, const FcCharSet *cs)
            if (!serialize->cs_freezer)
                return FcFalse;
        }
+       if (FcCharSetFindFrozen (serialize->cs_freezer, cs))
+           return FcTrue;
+    
         cs = FcCharSetFreeze (serialize->cs_freezer, cs);
     }
     
@@ -1359,3 +1358,6 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
     
     return cs_serialized;
 }
+#define __fccharset__
+#include "fcaliastail.h"
+#undef __fccharset__