summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-06-10 13:08:11 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-06-10 13:08:11 +0300
commit779c05972673122d5a34f76e42932af3ab9f2a84 (patch)
tree97817a49cab37431e339eeb210274b3a33f8e8da
parentb4b6e53183ffe928932a11bf30de0c186510e7b4 (diff)
downloadrpm-779c05972673122d5a34f76e42932af3ab9f2a84.tar.gz
rpm-779c05972673122d5a34f76e42932af3ab9f2a84.tar.bz2
rpm-779c05972673122d5a34f76e42932af3ab9f2a84.zip
Convert psm markReplacedFiles() to new headerGet() interface
-rw-r--r--lib/psm.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/psm.c b/lib/psm.c
index 82aaa34a7..c0fd602c9 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -156,7 +156,6 @@ static rpmRC markReplacedFiles(const rpmpsm psm)
{
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
- HGE_t hge = (HGE_t)fi->hge;
sharedFileInfo replaced = fi->replaced;
sharedFileInfo sfi;
rpmdbMatchIterator mi;
@@ -194,21 +193,22 @@ static rpmRC markReplacedFiles(const rpmpsm psm)
sfi = replaced;
while ((h = rpmdbNextIterator(mi)) != NULL) {
- char * secStates;
int modified;
- rpm_count_t count;
-
+ struct rpmtd_s secStates;
modified = 0;
- if (!hge(h, RPMTAG_FILESTATES, NULL, (rpm_data_t *)&secStates, &count))
+ if (!headerGet(h, RPMTAG_FILESTATES, &secStates, HEADERGET_MINMEM))
continue;
prev = rpmdbGetIteratorOffset(mi);
num = 0;
while (sfi->otherPkg && sfi->otherPkg == prev) {
- assert(sfi->otherFileNum < count);
- if (secStates[sfi->otherFileNum] != RPMFILE_STATE_REPLACED) {
- secStates[sfi->otherFileNum] = RPMFILE_STATE_REPLACED;
+ int ix = rpmtdSetIndex(&secStates, sfi->otherFileNum);
+ assert(ix != -1);
+
+ char *state = rpmtdGetChar(&secStates);
+ if (state && *state != RPMFILE_STATE_REPLACED) {
+ *state = RPMFILE_STATE_REPLACED;
if (modified == 0) {
/* Modified header will be rewritten. */
modified = 1;
@@ -218,6 +218,7 @@ static rpmRC markReplacedFiles(const rpmpsm psm)
}
sfi++;
}
+ rpmtdFreeData(&secStates);
}
mi = rpmdbFreeIterator(mi);
free(offsets);