X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffccfg.c;h=0f89b57a415f61cca22418e8cdcc52fd82c7bccd;hb=390c05e64a3716f6ea6fd81cf3ab63439051fbaa;hp=95c50162d0959cf93917996182e8d3cf0c1225ee;hpb=398d436441d741d6f8edcc25ca01aa9715c0731c;p=fontconfig.git diff --git a/src/fccfg.c b/src/fccfg.c index 95c5016..0f89b57 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -93,6 +93,8 @@ FcConfigCreate (void) config->rescanTime = time(0); config->rescanInterval = 30; + config->expr_pool = NULL; + config->ref = 1; return config; @@ -193,6 +195,26 @@ FcSubstDestroy (FcSubst *s) } } +FcExpr * +FcConfigAllocExpr (FcConfig *config) +{ + if (!config->expr_pool || config->expr_pool->next == config->expr_pool->end) + { + FcExprPage *new_page; + + new_page = malloc (sizeof (FcExprPage)); + if (!new_page) + return 0; + FcMemAlloc (FC_MEM_EXPR, sizeof (FcExprPage)); + + new_page->next_page = config->expr_pool; + new_page->next = new_page->exprs; + config->expr_pool = new_page; + } + + return config->expr_pool->next++; +} + FcConfig * FcConfigReference (FcConfig *config) { @@ -212,6 +234,7 @@ void FcConfigDestroy (FcConfig *config) { FcSetName set; + FcExprPage *page; if (--config->ref > 0) return; @@ -238,6 +261,15 @@ FcConfigDestroy (FcConfig *config) if (config->fonts[set]) FcFontSetDestroy (config->fonts[set]); + page = config->expr_pool; + while (page) + { + FcExprPage *next = page->next_page; + FcMemFree (FC_MEM_EXPR, sizeof (FcExprPage)); + free (page); + page = next; + } + free (config); FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig)); }