diff options
author | Patrick Lam <plam@MIT.EDU> | 2005-11-18 04:21:10 +0000 |
---|---|---|
committer | Patrick Lam <plam@MIT.EDU> | 2005-11-18 04:21:10 +0000 |
commit | 82912b062b1bb902db54e5b79f4a2d6a33ccd8a0 (patch) | |
tree | a2be263728cccd852c303270ac9b7c8e55d277c5 | |
parent | 38b2ecad5af4f7f7a55023afafaae075ecd3c753 (diff) |
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
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/fccfg.c | 17 |
2 files changed, 15 insertions, 11 deletions
@@ -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> * src/fccfg.c (FcConfigValues): diff --git a/src/fccfg.c b/src/fccfg.c index 3c311f9..4543553 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -1091,7 +1091,6 @@ static FcValueList * FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding) { FcValueList *l; - FcValueListPtr lp; if (!e) return 0; @@ -1110,19 +1109,15 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding) l->next = FcValueListPtrCreateDynamic(0); } l->binding = binding; - lp = FcValueListPtrCreateDynamic(l); - while (FcValueListPtrU(lp) && FcValueListPtrU(lp)->value.type == FcTypeVoid) + if (l->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); - } - lp = next; - l = FcValueListPtrU (lp); + FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList)); + free (l); + l = next; } + return l; } |