FcValueList ** _fcValueLists = 0;
static int fcvaluelist_bank_count = 0, fcvaluelist_ptr, fcvaluelist_count;
-static const char *
-FcPatternFindFullFname (const FcPattern *p);
static FcPatternEltPtr
FcPatternEltPtrCreateDynamic (FcPatternElt * e);
+static FcBool
+FcStrHashed (const FcChar8 *name);
+
+static const char *
+FcPatternFindFullFname (const FcPattern *p);
/* If you are trying to duplicate an FcPattern which will be used for
* rendering, be aware that (internally) you also have to use
{
switch (v.type) {
case FcTypeString:
- FcStrFree ((FcChar8 *) v.u.s);
+ if (!FcStrHashed (v.u.s))
+ FcStrFree ((FcChar8 *) v.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *) v.u.m);
{
switch (FcValueListPtrU(l)->value.type) {
case FcTypeString:
- FcStrFree ((FcChar8 *)FcValueListPtrU(l)->value.u.s);
+ if (!FcStrHashed ((FcChar8 *)FcValueListPtrU(l)->value.u.s))
+ FcStrFree ((FcChar8 *)FcValueListPtrU(l)->value.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *)FcValueListPtrU(l)->value.u.m);
{
FcValue v;
+ if (!s)
+ {
+ v.type = FcTypeVoid;
+ v.u.s = 0;
+ return FcPatternAdd (p, object, v, FcTrue);
+ }
+
v.type = FcTypeString;
v.u.s = FcStrStaticName(s);
return FcPatternAdd (p, object, v, FcTrue);
FcChar32 hash;
} *FcObjectBuckets[OBJECT_HASH_SIZE];
+static FcBool
+FcStrHashed (const FcChar8 *name)
+{
+ FcChar32 hash = FcStringHash (name);
+ struct objectBucket **p;
+ struct objectBucket *b;
+
+ for (p = &FcObjectBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
+ if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
+ return FcTrue;
+ return FcFalse;
+}
+
const FcChar8 *
FcStrStaticName (const FcChar8 *name)
{