summaryrefslogtreecommitdiff
path: root/lib/rpmfi.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-11-20 09:53:27 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-11-20 09:53:27 +0200
commit325198377df0be04a801d4f4c10dc698ce9d6c38 (patch)
tree2b305c6447517c648e7ded66c9167af63fa3d4df /lib/rpmfi.c
parente5d97430b62ed01bc3311de83eccdf48bb20a8cf (diff)
downloadlibrpm-tizen-325198377df0be04a801d4f4c10dc698ce9d6c38.tar.gz
librpm-tizen-325198377df0be04a801d4f4c10dc698ce9d6c38.tar.bz2
librpm-tizen-325198377df0be04a801d4f4c10dc698ce9d6c38.zip
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
Diffstat (limited to 'lib/rpmfi.c')
-rw-r--r--lib/rpmfi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index a206f5417..1af97aafe 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -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;