+2005-12-05 Patrick Lam <plam@mit.edu>
+ * src/fcpat.c (FcValueDestroy, FcValueListDestroy, FcStrHashed):
+
+ Don't free strings that have been returned from FcStrStaticName.
+
2005-12-01 Patrick Lam <plam@mit.edu>
* fc-cat/fc-cat.c (FcCacheGlobalFileReadAndPrint, main):
static FcPatternEltPtr
FcPatternEltPtrCreateDynamic (FcPatternElt * e);
+static FcBool
+FcStrHashed (const FcChar8 *name);
static const char *
FcPatternFindFullFname (const FcPattern *p);
{
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);
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)
{