diff options
author | Akira TAGOH <akira@tagoh.org> | 2017-11-15 16:10:49 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2017-11-20 17:37:22 +0530 |
commit | 8f88b1c47cb7918aa65ed415f64e04464b1653c9 (patch) | |
tree | 2942722d8d96903a2bfc3dabb0a0c7fcd81b9801 /src/fccfg.c | |
parent | 68ff99c4142e25989409f465e392b1bb3042494d (diff) |
abstract hash table functions
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); |