Cache: Remove alias_table

There is really no need for this anymore

https://bugs.freedesktop.org/show_bug.cgi?id=106618
This commit is contained in:
Alexander Larsson 2018-05-23 16:00:01 +02:00 committed by Akira TAGOH
parent c42402d0b8
commit 3ea70f9368
3 changed files with 5 additions and 26 deletions

View File

@ -278,26 +278,22 @@ static FcChar8 *
FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], FcConfig *config) FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], FcConfig *config)
{ {
void *u; void *u;
FcChar8 *alias, *target; FcChar8 *target;
const FcChar8 *sysroot = FcConfigGetSysRoot (config); const FcChar8 *sysroot = FcConfigGetSysRoot (config);
if (!FcHashTableFind (config->alias_table, dir, (void **)&alias))
alias = FcStrdup (dir);
if (sysroot) if (sysroot)
target = FcStrBuildFilename (sysroot, alias, NULL); target = FcStrBuildFilename (sysroot, dir, NULL);
else else
target = FcStrdup (alias); target = FcStrdup (dir);
if (FcHashTableFind (config->uuid_table, target, &u)) if (FcHashTableFind (config->uuid_table, target, &u))
{ {
uuid_unparse (u, (char *) cache_base); uuid_unparse (u, (char *) cache_base);
strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX); strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX);
FcHashUuidFree (u); FcHashUuidFree (u);
FcStrFree (target); FcStrFree (target);
FcStrFree (alias);
return cache_base; return cache_base;
} }
FcStrFree (target); FcStrFree (target);
FcStrFree (alias);
return NULL; return NULL;
} }
#endif #endif
@ -1017,7 +1013,6 @@ FcCache *
FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file) FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
{ {
FcCache *cache = NULL; FcCache *cache = NULL;
const FcChar8 *d;
#ifndef _WIN32 #ifndef _WIN32
FcDirCacheReadUUID ((FcChar8 *) dir, config); FcDirCacheReadUUID ((FcChar8 *) dir, config);
@ -1027,10 +1022,6 @@ FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
&cache, cache_file)) &cache, cache_file))
return NULL; return NULL;
d = FcCacheDir (cache);
if (FcStrCmp (dir, d))
FcHashTableAdd (config->alias_table, (FcChar8 *) d, (FcChar8 *) dir);
return cache; return cache;
} }

View File

@ -144,12 +144,6 @@ FcConfigCreate (void)
FcHashUuidCopy, FcHashUuidCopy,
(FcDestroyFunc) FcStrFree, (FcDestroyFunc) FcStrFree,
FcHashUuidFree); FcHashUuidFree);
config->alias_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
(FcCompareFunc) FcStrCmp,
FcHashStrCopy,
FcHashStrCopy,
(FcDestroyFunc) FcStrFree,
(FcDestroyFunc) FcStrFree);
FcRefInit (&config->ref, 1); FcRefInit (&config->ref, 1);
@ -313,7 +307,6 @@ FcConfigDestroy (FcConfig *config)
FcStrFree (config->sysRoot); FcStrFree (config->sysRoot);
FcHashTableDestroy (config->uuid_table); FcHashTableDestroy (config->uuid_table);
FcHashTableDestroy (config->alias_table);
free (config); free (config);
} }
@ -398,18 +391,14 @@ FcConfigAddCache (FcConfig *config, FcCache *cache,
for (i = 0; i < cache->dirs_count; i++) for (i = 0; i < cache->dirs_count; i++)
{ {
const FcChar8 *dir = FcCacheSubdir (cache, i); const FcChar8 *dir = FcCacheSubdir (cache, i);
FcChar8 *alias;
FcChar8 *d = FcStrDirname (dir);
FcChar8 *s = NULL; FcChar8 *s = NULL;
if (FcHashTableFind (config->alias_table, d, (void **)&alias)) if (relocated)
{ {
FcChar8 *base = FcStrBasename (dir); FcChar8 *base = FcStrBasename (dir);
dir = s = FcStrBuildFilename (alias, base, NULL); dir = s = FcStrBuildFilename (forDir, base, NULL);
FcStrFree (alias);
FcStrFree (base); FcStrFree (base);
} }
FcStrFree (d);
if (FcConfigAcceptFilename (config, dir)) if (FcConfigAcceptFilename (config, dir))
FcStrSetAddFilename (dirSet, dir); FcStrSetAddFilename (dirSet, dir);
if (s) if (s)

View File

@ -566,7 +566,6 @@ struct _FcConfig {
FcStrSet *availConfigFiles; /* config files available */ FcStrSet *availConfigFiles; /* config files available */
FcPtrList *rulesetList; /* List of rulesets being installed */ FcPtrList *rulesetList; /* List of rulesets being installed */
FcHashTable *uuid_table; /* UUID table for cachedirs */ FcHashTable *uuid_table; /* UUID table for cachedirs */
FcHashTable *alias_table; /* alias table for cachedirs */
}; };
typedef struct _FcFileTime { typedef struct _FcFileTime {