]> git.wh0rd.org - fontconfig.git/commitdiff
Don't use FcCharSetCopy in FcCharSetMerge
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 8 Jan 2009 08:04:34 +0000 (03:04 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 14 Feb 2009 00:54:06 +0000 (16:54 -0800)
The Copy function is actually a ref, not real copy.

doc/fccharset.fncs
src/fccharset.c

index 93e1f5c1e5fcfac1f3e0e14bd8d466930185a61b..0dd7d1a5c644d4a00ac052d2c7aba176515486c6 100644 (file)
@@ -104,7 +104,7 @@ Returns a set including only those chars found in <parameter>a</parameter> but n
 @TYPE2@                const FcCharSet *       @ARG2@          b
 @PURPOSE@      Merge charsets
 @DESC@
-If <parameter>a</parameter> is NULL, returns a copy of <parameter>b</parameter>.
+If <parameter>a</parameter> is NULL, returns a newly-created copy of <parameter>b</parameter>.
 If <parameter>a</parameter> is an FcCharSet object owned by fontconfig that
 cannot be modified, it returns the union of <parameter>a</parameter> and
 <parameter>b</parameter> in a newly-created FcCharSet object.
index 1891f08f01ae28b6d05b45442c4a81cceb3625c5..2daa39d59bef9ef68b43257505e11dfb7a359d34 100644 (file)
@@ -459,14 +459,15 @@ FcCharSetMerge (FcCharSet *a, const FcCharSet *b)
     FcCharSetIter    ai, bi;
 
     if (a == NULL) {
-       return FcCharSetCopy ((FcCharSet *) b);
+       fcs = a = FcCharSetCreate ();
     } else if (a->ref == FC_REF_CONSTANT) {
        fcs = FcCharSetCreate ();
-       if (fcs == NULL)
-           return NULL;
     } else
        fcs = a;
 
+    if (fcs == NULL)
+       return NULL;
+
     FcCharSetIterStart (a, &ai);
     FcCharSetIterStart (b, &bi);
     while (ai.leaf || bi.leaf)