Simplify FcValueSave() semantics

This commit is contained in:
Behdad Esfahbod 2009-06-05 16:49:07 -04:00
parent 8ea654b2aa
commit efe5eae26b
2 changed files with 4 additions and 11 deletions

View File

@ -852,7 +852,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break; break;
case FcOpString: case FcOpString:
v.type = FcTypeString; v.type = FcTypeString;
v.u.s = FcStrStaticName(e->u.sval); v.u.s = e->u.sval;
v = FcValueSave (v);
break; break;
case FcOpMatrix: case FcOpMatrix:
v.type = FcTypeMatrix; v.type = FcTypeMatrix;

View File

@ -98,7 +98,7 @@ FcValueSave (FcValue v)
{ {
switch (v.type) { switch (v.type) {
case FcTypeString: case FcTypeString:
v.u.s = FcStrCopy (v.u.s); v.u.s = FcStrStaticName (v.u.s);
if (!v.u.s) if (!v.u.s)
v.type = FcTypeVoid; v.type = FcTypeVoid;
break; break;
@ -482,15 +482,7 @@ FcPatternObjectAddWithBinding (FcPattern *p,
memset(new, 0, sizeof (FcValueList)); memset(new, 0, sizeof (FcValueList));
FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList)); FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList));
/* dup string */ value = FcValueSave (value);
if (value.type == FcTypeString)
{
value.u.s = FcStrStaticName (value.u.s);
if (!value.u.s)
value.type = FcTypeVoid;
}
else
value = FcValueSave (value);
if (value.type == FcTypeVoid) if (value.type == FcTypeVoid)
goto bail1; goto bail1;