diff options
author | Akira TAGOH <akira@tagoh.org> | 2018-01-03 22:15:11 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2018-01-03 22:15:11 +0900 |
commit | 97898b1158542d3bc5f8a95fe2aa1829512cceb8 (patch) | |
tree | 43bd76edd5ee5fa115de4eeb4b2fa0d84ecaa361 /src | |
parent | 5cfd594c71345bcb91a56100fc3bbfef15253a95 (diff) |
Fix the mis-ordering of ruleset evaluation in a file with include element
Diffstat (limited to 'src')
-rw-r--r-- | src/fccfg.c | 8 | ||||
-rw-r--r-- | src/fcxml.c | 22 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index be2e993b..98440179 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -1650,6 +1650,10 @@ FcConfigSubstituteWithPat (FcConfig *config, for (; FcPtrListIterIsValid (s, &iter); FcPtrListIterNext (s, &iter)) { rs = (FcRuleSet *) FcPtrListIterGetValue (s, &iter); + if (FcDebug () & FC_DBG_EDIT) + { + printf ("\nRule Set: %s\n", rs->name); + } FcPtrListIterInit (rs->subst[kind], &iter2); for (; FcPtrListIterIsValid (rs->subst[kind], &iter2); FcPtrListIterNext (rs->subst[kind], &iter2)) { @@ -2553,7 +2557,7 @@ FcRuleSetAddDescription (FcRuleSet *rs, FcStrFree (rs->description); rs->domain = domain ? FcStrdup (domain) : NULL; - rs->description = FcStrdup (description); + rs->description = description ? FcStrdup (description) : NULL; } int @@ -2594,7 +2598,7 @@ FcRuleSetAdd (FcRuleSet *rs, } if (FcDebug () & FC_DBG_EDIT) { - printf ("Add Rule "); + printf ("Add Rule(kind:%d, name: %s) ", kind, rs->name); FcRulePrint (rule); } ret = FC_OBJ_ID (n) - FC_MAX_BASE_OBJECT; diff --git a/src/fcxml.c b/src/fcxml.c index 61284466..22b3211e 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -2304,6 +2304,8 @@ FcParseInclude (FcConfigParse *parse) #endif FcChar8 *prefix = NULL, *p; FcChar8 *userdir = NULL, *userconf = NULL; + FcRuleSet *ruleset; + FcMatchKind k; s = FcStrBufDoneStatic (&parse->pstack->str); if (!s) @@ -2387,6 +2389,24 @@ FcParseInclude (FcConfigParse *parse) goto userconf; } } + /* flush the ruleset into the queue */ + ruleset = parse->ruleset; + parse->ruleset = FcRuleSetCreate (ruleset->name); + FcRuleSetEnable (parse->ruleset, ruleset->enabled); + FcRuleSetAddDescription (parse->ruleset, ruleset->domain, ruleset->description); + for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++) + { + FcPtrListIter iter; + + FcPtrListIterInit (ruleset->subst[k], &iter); + if (FcPtrListIterIsValid (ruleset->subst[k], &iter)) + { + FcPtrListIterInitAtLast (parse->config->subst[k], &iter); + FcRuleSetReference (ruleset); + FcPtrListIterAdd (parse->config->subst[k], &iter, ruleset); + } + } + FcRuleSetDestroy (ruleset); if (!FcConfigParseAndLoad (parse->config, s, !ignore_missing)) parse->error = FcTrue; #ifndef _WIN32 @@ -3351,6 +3371,8 @@ bail1: FcConfigMessage (0, FcSevereError, "Cannot %s config file from %s", load ? "load" : "scan", filename); return FcFalse; } + if (FcDebug () & FC_DBG_CONFIG) + printf ("\t%s config file from %s done\n", load ? "Loading" : "Scanning", filename); return FcTrue; } |