From e2560f942613b8b72eeb9365c8e0171d9e9b805d Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 23 May 2018 16:00:01 +0200 Subject: [PATCH 3/3] Cache: Remove alias_table There is really no need for this anymore https://bugs.freedesktop.org/show_bug.cgi?id=106618 --- src/fccache.c | 15 +++------------ src/fccfg.c | 15 ++------------- src/fcint.h | 1 - 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/fccache.c b/src/fccache.c index 041c77b..667d4e7 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -278,26 +278,22 @@ static FcChar8 * FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], FcConfig *config) { void *u; - FcChar8 *alias, *target; + FcChar8 *target; const FcChar8 *sysroot = FcConfigGetSysRoot (config); - if (!FcHashTableFind (config->alias_table, dir, (void **)&alias)) - alias = FcStrdup (dir); if (sysroot) - target = FcStrBuildFilename (sysroot, alias, NULL); + target = FcStrBuildFilename (sysroot, dir, NULL); else - target = FcStrdup (alias); + target = FcStrdup (dir); if (FcHashTableFind (config->uuid_table, target, &u)) { uuid_unparse (u, (char *) cache_base); strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX); FcHashUuidFree (u); FcStrFree (target); - FcStrFree (alias); return cache_base; } FcStrFree (target); - FcStrFree (alias); return NULL; } #endif @@ -1017,7 +1013,6 @@ FcCache * FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file) { FcCache *cache = NULL; - const FcChar8 *d; #ifndef _WIN32 FcDirCacheReadUUID ((FcChar8 *) dir, config); @@ -1027,10 +1022,6 @@ FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file) &cache, cache_file)) return NULL; - d = FcCacheDir (cache); - if (FcStrCmp (dir, d)) - FcHashTableAdd (config->alias_table, (FcChar8 *) d, (FcChar8 *) dir); - return cache; } diff --git a/src/fccfg.c b/src/fccfg.c index ffe189a..f9fc99a 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -144,12 +144,6 @@ FcConfigCreate (void) FcHashUuidCopy, (FcDestroyFunc) FcStrFree, FcHashUuidFree); - config->alias_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase, - (FcCompareFunc) FcStrCmp, - FcHashStrCopy, - FcHashStrCopy, - (FcDestroyFunc) FcStrFree, - (FcDestroyFunc) FcStrFree); FcRefInit (&config->ref, 1); @@ -313,7 +307,6 @@ FcConfigDestroy (FcConfig *config) FcStrFree (config->sysRoot); FcHashTableDestroy (config->uuid_table); - FcHashTableDestroy (config->alias_table); free (config); } @@ -398,18 +391,14 @@ FcConfigAddCache (FcConfig *config, FcCache *cache, for (i = 0; i < cache->dirs_count; i++) { const FcChar8 *dir = FcCacheSubdir (cache, i); - FcChar8 *alias; - FcChar8 *d = FcStrDirname (dir); FcChar8 *s = NULL; - if (FcHashTableFind (config->alias_table, d, (void **)&alias)) + if (relocated) { FcChar8 *base = FcStrBasename (dir); - dir = s = FcStrBuildFilename (alias, base, NULL); - FcStrFree (alias); + dir = s = FcStrBuildFilename (forDir, base, NULL); FcStrFree (base); } - FcStrFree (d); if (FcConfigAcceptFilename (config, dir)) FcStrSetAddFilename (dirSet, dir); if (s) diff --git a/src/fcint.h b/src/fcint.h index 966559f..b688aa4 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -566,7 +566,6 @@ struct _FcConfig { FcStrSet *availConfigFiles; /* config files available */ FcPtrList *rulesetList; /* List of rulesets being installed */ FcHashTable *uuid_table; /* UUID table for cachedirs */ - FcHashTable *alias_table; /* alias table for cachedirs */ }; typedef struct _FcFileTime { -- 2.17.0