summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-26 12:32:32 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-26 12:32:32 +0300
commit50983815f090262dd782df07a8827b290bacfcdb (patch)
tree3a6c4e92ea89ba1d2fb4159a97075cd397640888 /build
parent1c18cb27e6bc9085e51e127732dd9e8051224ba9 (diff)
downloadlibrpm-tizen-50983815f090262dd782df07a8827b290bacfcdb.tar.gz
librpm-tizen-50983815f090262dd782df07a8827b290bacfcdb.tar.bz2
librpm-tizen-50983815f090262dd782df07a8827b290bacfcdb.zip
Dont waste time with argi for rpmfc file class indexes
- argiAdd() isn't as costly as argvAdd(), but it still involves unnecessary reallocation on every addition as the number of files is predetermined, and each file has an associated class index. - Additionally fixes a mostly harmless glitch introduced in commit 65e616cc9fdd00f523939088fab1070021b9f742: the pool id's are one larger than the indexes we store in headers, take this into account in the debug output.
Diffstat (limited to 'build')
-rw-r--r--build/rpmfc.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 697d7c29d..7de2da177 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -49,7 +49,7 @@ struct rpmfc_s {
char ** fn; /*!< (no. files) file names */
ARGV_t *fattrs; /*!< (no. files) file attribute tokens */
rpm_color_t *fcolor;/*!< (no. files) file colors */
- ARGI_t fcdictx; /*!< (no. files) file class dictionary indices */
+ rpmsid *fcdictx; /*!< (no. files) file class dictionary indices */
ARGI_t fddictx; /*!< (no. files) file depends dictionary start */
ARGI_t fddictn; /*!< (no. files) file depends dictionary no. entries */
ARGI_t ddictx; /*!< (no. dependencies) file->dependency mapping */
@@ -661,7 +661,6 @@ void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
{
rpm_color_t fcolor;
int ndx;
- int cx;
int dx;
int fx;
@@ -678,8 +677,7 @@ nrequires = rpmdsCount(fc->requires);
if (fc)
for (fx = 0; fx < fc->nfiles; fx++) {
-assert(fx < fc->fcdictx->nvals);
- cx = fc->fcdictx->vals[fx];
+ rpmsid cx = fc->fcdictx[fx] + 1; /* id's are one off */
fcolor = fc->fcolor[fx];
ARGV_t fattrs = fc->fattrs[fx];
@@ -755,7 +753,7 @@ rpmfc rpmfcFree(rpmfc fc)
free(fc->fn);
free(fc->fattrs);
free(fc->fcolor);
- argiFree(fc->fcdictx);
+ free(fc->fcdictx);
argiFree(fc->fddictx);
argiFree(fc->fddictn);
argiFree(fc->ddictx);
@@ -923,6 +921,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
fc->fn = xcalloc(fc->nfiles, sizeof(*fc->fn));
fc->fattrs = xcalloc(fc->nfiles, sizeof(*fc->fattrs));
fc->fcolor = xcalloc(fc->nfiles, sizeof(*fc->fcolor));
+ fc->fcdictx = xcalloc(fc->nfiles, sizeof(*fc->fcdictx));
/* Initialize the per-file dictionary indices. */
argiAdd(&fc->fddictx, fc->nfiles-1, 0);
@@ -1015,7 +1014,7 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
fc->fwhite++;
}
/* Pool id's start from 1, for headers we want it from 0 */
- argiAdd(&fc->fcdictx, fc->ix, ftypeId - 1);
+ fc->fcdictx[fc->ix] = ftypeId - 1;
}
rc = RPMRC_OK;
@@ -1295,9 +1294,7 @@ rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg)
}
/* Add per-file classes(#files) */
- if (rpmtdFromArgi(&td, RPMTAG_FILECLASS, fc->fcdictx)) {
- headerPut(pkg->header, &td, HEADERPUT_DEFAULT);
- }
+ headerPutUint32(pkg->header, RPMTAG_FILECLASS, fc->fcdictx, fc->nfiles);
/* Add Provides: */
if (!fc->skipProv) {