Use global cache for file languages too
- there's only a very limited number of language names ever present, and most files don't have languages attached at all - another few megs saved on memory
This commit is contained in:
parent
e5d97430b6
commit
325198377d
|
@ -34,6 +34,8 @@ struct strcache_s {
|
|||
|
||||
static struct strcache_s _ugcache = { NULL, 0 };
|
||||
static strcache ugcache = &_ugcache;
|
||||
static struct strcache_s _langcache = { NULL, 0 };
|
||||
static strcache langcache = &_langcache;
|
||||
|
||||
static scidx_t strcachePut(strcache cache, const char *str)
|
||||
{
|
||||
|
@ -431,7 +433,7 @@ const char * rpmfiFLangs(rpmfi fi)
|
|||
{
|
||||
const char *flangs = NULL;
|
||||
if (fi != NULL && fi->flangs != NULL && fi->i >= 0 && fi->i < fi->fc) {
|
||||
flangs = fi->flangs[fi->i];
|
||||
flangs = strcacheGet(langcache, fi->flangs[fi->i]);
|
||||
}
|
||||
return flangs;
|
||||
}
|
||||
|
@ -1384,7 +1386,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
|
|||
_hgfi(h, RPMTAG_FILELINKTOS, &td, defFlags, fi->flinks);
|
||||
/* FILELANGS are only interesting when installing */
|
||||
if ((headerGetInstance(h) == 0) && !(flags & RPMFI_NOFILELANGS))
|
||||
_hgfi(h, RPMTAG_FILELANGS, &td, defFlags, fi->flangs);
|
||||
fi->flangs = cacheTag(langcache, h, RPMTAG_FILELANGS);
|
||||
|
||||
/* See if the package has non-md5 file digests */
|
||||
fi->digestalgo = PGPHASHALGO_MD5;
|
||||
|
|
|
@ -42,7 +42,7 @@ struct rpmfi_s {
|
|||
const char ** dnl; /*!< Directory name(s) (from header) */
|
||||
|
||||
const char ** flinks; /*!< File link(s) (from header) */
|
||||
const char ** flangs; /*!< File lang(s) (from header) */
|
||||
scidx_t * flangs; /*!< Index to file lang(s) cache */
|
||||
|
||||
uint32_t * dil; /*!< Directory indice(s) (from header) */
|
||||
/*?null?*/
|
||||
|
|
Loading…
Reference in New Issue