diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-06-10 13:08:11 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-06-10 13:08:11 +0300 |
commit | 779c05972673122d5a34f76e42932af3ab9f2a84 (patch) | |
tree | 97817a49cab37431e339eeb210274b3a33f8e8da | |
parent | b4b6e53183ffe928932a11bf30de0c186510e7b4 (diff) | |
download | rpm-779c05972673122d5a34f76e42932af3ab9f2a84.tar.gz rpm-779c05972673122d5a34f76e42932af3ab9f2a84.tar.bz2 rpm-779c05972673122d5a34f76e42932af3ab9f2a84.zip |
Convert psm markReplacedFiles() to new headerGet() interface
-rw-r--r-- | lib/psm.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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); |