From 640db40ac593a2d30f556e277164e980508ee9ef Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 17 Dec 2009 16:17:45 +0200 Subject: [PATCH] Eliminate unnecessary ts ping-pong inside rpmte - rpmteNew() and the stuff it calls doesn't need the transaction set for anything since a long time - document ts argument to be unused --- lib/rpmte.c | 19 ++++++++----------- lib/rpmte.h | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index 1684aa2..edf1e54 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -119,7 +119,7 @@ static void delTE(rpmte p) return; } -static rpmfi getFI(rpmte p, rpmts ts, Header h) +static rpmfi getFI(rpmte p, Header h) { rpmfiFlags fiflags; fiflags = (p->type == TR_ADDED) ? (RPMFI_NOHEADER | RPMFI_FLAGS_INSTALL) : @@ -131,7 +131,7 @@ static rpmfi getFI(rpmte p, rpmts ts, Header h) rpmRelocateFileList(p->relocs, p->nrelocs, p->fs, h); } } - return rpmfiNew(ts, h, RPMTAG_BASENAMES, fiflags); + return rpmfiNew(NULL, h, RPMTAG_BASENAMES, fiflags); } /* stupid bubble sort, but it's probably faster here */ @@ -154,7 +154,7 @@ static void sortRelocs(rpmRelocation *relocations, int numRelocations) } } -static void buildRelocs(rpmts ts, rpmte p, Header h, rpmRelocation *relocs) +static void buildRelocs(rpmte p, Header h, rpmRelocation *relocs) { int i; struct rpmtd_s validRelocs; @@ -223,15 +223,12 @@ static void buildRelocs(rpmts ts, rpmte p, Header h, rpmRelocation *relocs) /** * Initialize transaction element data from header. - * @param ts transaction set * @param p transaction element * @param h header * @param key (TR_ADDED) package retrieval key (e.g. file name) * @param relocs (TR_ADDED) package file relocations */ -static void addTE(rpmts ts, rpmte p, Header h, - fnpyKey key, - rpmRelocation * relocs) +static void addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs) { p->name = headerGetAsString(h, RPMTAG_NAME); p->version = headerGetAsString(h, RPMTAG_VERSION); @@ -253,7 +250,7 @@ static void addTE(rpmts ts, rpmte p, Header h, p->nrelocs = 0; p->relocs = NULL; if (relocs != NULL) - buildRelocs(ts, p, h, relocs); + buildRelocs(p, h, relocs); p->db_instance = headerGetInstance(h); p->key = key; @@ -276,7 +273,7 @@ static void addTE(rpmts ts, rpmte p, Header h, rpmtdFreeData(&bnames); } - p->fi = getFI(p, ts, h); + p->fi = getFI(p, h); /* See if we have pre/posttrans scripts. */ p->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) && @@ -309,7 +306,7 @@ rpmte rpmteNew(const rpmts ts, Header h, rpmte p = xcalloc(1, sizeof(*p)); p->type = type; - addTE(ts, p, h, key, relocs); + addTE(p, h, key, relocs); switch (type) { case TR_ADDED: p->pkgFileSize = headerGetNumber(h, RPMTAG_LONGSIGSIZE) + 96 + 256; @@ -805,7 +802,7 @@ int rpmteOpen(rpmte te, rpmts ts, int reload_fi) } if (h != NULL) { if (reload_fi) { - te->fi = getFI(te, ts, h); + te->fi = getFI(te, h); } rpmteSetHeader(te, h); diff --git a/lib/rpmte.h b/lib/rpmte.h index a28fdde..bc1ffcd 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -43,7 +43,7 @@ rpmte rpmteFree(rpmte te); /** \ingroup rpmte * Create a transaction element. - * @param ts transaction set + * @param ts unused * @param h header * @param type TR_ADDED/TR_REMOVED * @param key (TR_ADDED) package retrieval key (e.g. file name) -- 2.7.4