List iteration not needed in FcConfigValues, since it's building up the

list itself; we can just strip FcVoid elements during construction.
reviewed by: plam
This commit is contained in:
Patrick Lam 2005-11-18 04:21:10 +00:00
parent 38b2ecad5a
commit 82912b062b
2 changed files with 15 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2005-10-25 Jinghua Luo <sunmoon1997@gmail.com>
reviewed by: plam
* src/fccfg.c (FcConfigValues):
List iteration not needed in FcConfigValues, since it's building
up the list itself; we can just strip FcVoid elements during
construction.
2005-11-17 Patrick Lam <plam@mit.edu> 2005-11-17 Patrick Lam <plam@mit.edu>
* src/fccfg.c (FcConfigValues): * src/fccfg.c (FcConfigValues):

View File

@ -1091,7 +1091,6 @@ static FcValueList *
FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding) FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
{ {
FcValueList *l; FcValueList *l;
FcValueListPtr lp;
if (!e) if (!e)
return 0; return 0;
@ -1110,19 +1109,15 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
l->next = FcValueListPtrCreateDynamic(0); l->next = FcValueListPtrCreateDynamic(0);
} }
l->binding = binding; l->binding = binding;
lp = FcValueListPtrCreateDynamic(l); if (l->value.type == FcTypeVoid)
while (FcValueListPtrU(lp) && FcValueListPtrU(lp)->value.type == FcTypeVoid)
{ {
FcValueListPtr next = FcValueListPtrU(lp)->next; FcValueList *next = FcValueListPtrU(l->next);
if (lp.bank == FC_BANK_DYNAMIC) FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
{ free (l);
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); l = next;
free (l);
}
lp = next;
l = FcValueListPtrU (lp);
} }
return l; return l;
} }