From efe5eae26b2443363b1000b3197d1731a40f8af9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 5 Jun 2009 16:49:07 -0400 Subject: [PATCH] Simplify FcValueSave() semantics --- src/fccfg.c | 3 ++- src/fcpat.c | 12 ++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/fccfg.c b/src/fccfg.c index da13f8c..95c5016 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -852,7 +852,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) break; case FcOpString: v.type = FcTypeString; - v.u.s = FcStrStaticName(e->u.sval); + v.u.s = e->u.sval; + v = FcValueSave (v); break; case FcOpMatrix: v.type = FcTypeMatrix; diff --git a/src/fcpat.c b/src/fcpat.c index 188f560..792a164 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -98,7 +98,7 @@ FcValueSave (FcValue v) { switch (v.type) { case FcTypeString: - v.u.s = FcStrCopy (v.u.s); + v.u.s = FcStrStaticName (v.u.s); if (!v.u.s) v.type = FcTypeVoid; break; @@ -482,15 +482,7 @@ FcPatternObjectAddWithBinding (FcPattern *p, memset(new, 0, sizeof (FcValueList)); FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList)); - /* dup string */ - if (value.type == FcTypeString) - { - value.u.s = FcStrStaticName (value.u.s); - if (!value.u.s) - value.type = FcTypeVoid; - } - else - value = FcValueSave (value); + value = FcValueSave (value); if (value.type == FcTypeVoid) goto bail1;