]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccharset.c
Include $(top_srcdir), $(top_srcdir)/src before anything else.
[fontconfig.git] / src / fccharset.c
index d1a9d6ec6ad55bf1f963782abab25cdfcac1956c..e0a09612859857e4bd557d3ebff890b62f2d8c0f 100644 (file)
@@ -22,8 +22,8 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <stdlib.h>
 #include "fcint.h"
+#include <stdlib.h>
 
 /* #define CHECK */
 
@@ -168,6 +168,7 @@ FcCharSetPutLeaf (FcCharSet *fcs,
        return FcFalse;
     if (fcs->bank != FC_BANK_DYNAMIC)
     {
+        /* convert to dynamic */
        int i;
 
        leaves = malloc ((fcs->num + 1) * sizeof (FcCharLeaf *));
@@ -176,13 +177,20 @@ FcCharSetPutLeaf (FcCharSet       *fcs,
        FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
        numbers = malloc ((fcs->num + 1) * sizeof (FcChar16));
        if (!numbers)
+        {
+           free (leaves);
            return FcFalse;
+        }
        FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
 
        for (i = 0; i < fcs->num; i++)
            leaves[i] = FcCharSetGetLeaf(fcs, i);
        memcpy (numbers, FcCharSetGetNumbers(fcs), 
                fcs->num * sizeof (FcChar16));
+
+       fcs->bank = FC_BANK_DYNAMIC;
+       fcs->u.dyn.leaves = leaves;
+       fcs->u.dyn.numbers = numbers;
     }
     else
     {
@@ -620,7 +628,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
            int         i = 256/32;
            if (ai.ucs4 == bi.ucs4)
            {
-               FcChar32        *bm = bi.leaf->map;;
+               FcChar32        *bm = bi.leaf->map;
                while (i--)
                    count += FcCharSetPopCount (*am++ & ~*bm++);
            }