diff options
Diffstat (limited to 'src/fccfg.c')
-rw-r--r-- | src/fccfg.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index 5b876eec..be2e993b 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -151,6 +151,19 @@ FcConfigCreate (void) if (!config->availConfigFiles) goto bail10; + config->uuid_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase, + (FcCompareFunc) FcStrCmp, + FcHashStrCopy, + FcHashUuidCopy, + (FcDestroyFunc) FcStrFree, + FcHashUuidFree); + config->alias_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase, + (FcCompareFunc) FcStrCmp, + FcHashStrCopy, + FcHashStrCopy, + (FcDestroyFunc) FcStrFree, + (FcDestroyFunc) FcStrFree); + FcRefInit (&config->ref, 1); return config; @@ -312,6 +325,9 @@ FcConfigDestroy (FcConfig *config) if (config->sysRoot) FcStrFree (config->sysRoot); + FcHashTableDestroy (config->uuid_table); + FcHashTableDestroy (config->alias_table); + free (config); } @@ -371,14 +387,15 @@ FcConfigAddCache (FcConfig *config, FcCache *cache, for (i = 0; i < cache->dirs_count; i++) { const FcChar8 *dir = FcCacheSubdir (cache, i); - const FcChar8 *alias; + FcChar8 *alias; FcChar8 *d = FcStrDirname (dir); FcChar8 *s = NULL; - if ((alias = FcDirCacheFindAliasPath (d))) + if (FcHashTableFind (config->alias_table, d, (void **)&alias)) { FcChar8 *base = FcStrBasename (dir); dir = s = FcStrBuildFilename (alias, base, NULL); + FcStrFree (alias); FcStrFree (base); } FcStrFree (d); |