diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-07 12:55:28 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-07 13:34:50 +0300 |
commit | 90e3792232d204aaf6e38f2a30d372a993448560 (patch) | |
tree | 1e6fea19ef549cd212bfc3ac3f5fd30b4113dd47 /lib/rpmfi.c | |
parent | 8909eed1a83712b54e39dd559ef0661aaf29fb48 (diff) | |
download | librpm-tizen-90e3792232d204aaf6e38f2a30d372a993448560.tar.gz librpm-tizen-90e3792232d204aaf6e38f2a30d372a993448560.tar.bz2 librpm-tizen-90e3792232d204aaf6e38f2a30d372a993448560.zip |
Use string pool for file set symlinks
- Removes the last use of our former simple, stupid and slow caches
- For now, use a per-fi pool for this just like the previous caching
did. Memory use is slightly increased but its faster than before,
to reap the full benefits (memory and otherwise) we'll want a
per-transaction pool for these, to be added later.
Diffstat (limited to 'lib/rpmfi.c')
-rw-r--r-- | lib/rpmfi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 83b5f9714..4ac85d9ac 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -278,7 +278,7 @@ const char * rpmfiFLinkIndex(rpmfi fi, int ix) if (fi != NULL && ix >= 0 && ix < fi->fc) { if (fi->flinks != NULL) - flink = strcacheGet(fi->flinkcache, fi->flinks[ix]); + flink = rpmstrPoolStr(fi->pool, fi->flinks[ix]); } return flink; } @@ -1076,7 +1076,6 @@ rpmfi rpmfiFree(rpmfi fi) fi->bnl = _free(fi->bnl); fi->dnl = _free(fi->dnl); - fi->flinkcache = strcacheFree(fi->flinkcache); fi->flinks = _free(fi->flinks); fi->flangs = _free(fi->flangs); fi->digests = _free(fi->digests); @@ -1090,6 +1089,8 @@ rpmfi rpmfiFree(rpmfi fi) fi->fstates = _free(fi->fstates); fi->fps = _free(fi->fps); + fi->pool = rpmstrPoolFree(fi->pool); + /* these point to header memory if KEEPHEADER is used, dont free */ if (!(fi->fiflags & RPMFI_KEEPHEADER) && fi->h == NULL) { fi->fmtimes = _free(fi->fmtimes); @@ -1199,6 +1200,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags) /* XXX: ensure the global misc. pool exists */ if (miscpool == NULL) miscpool = rpmstrPoolCreate(); + fi->pool = rpmstrPoolCreate(); /* XXX TODO: all these should be sanity checked, ugh... */ if (!(flags & RPMFI_NOFILEMODES)) @@ -1231,10 +1233,8 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags) if (!(flags & RPMFI_NOFILECAPS)) _hgfi(h, RPMTAG_FILECAPS, &td, defFlags, fi->fcaps); - if (!(flags & RPMFI_NOFILELINKTOS)) { - fi->flinkcache = strcacheNew(); - fi->flinks = cacheTag(fi->flinkcache, h, RPMTAG_FILELINKTOS); - } + if (!(flags & RPMFI_NOFILELINKTOS)) + fi->flinks = tag2pool(fi->pool, h, RPMTAG_FILELINKTOS); /* FILELANGS are only interesting when installing */ if ((headerGetInstance(h) == 0) && !(flags & RPMFI_NOFILELANGS)) fi->flangs = tag2pool(miscpool, h, RPMTAG_FILELANGS); @@ -1285,6 +1285,8 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags) /* lazily alloced from rpmfiFN() */ fi->fn = NULL; + rpmstrPoolFreeze(fi->pool); + exit: if (fi != NULL) { |