diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-12 08:32:15 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-12 08:33:49 +0200 |
commit | d221895352955d5ee0503855f71c4bc242019273 (patch) | |
tree | 8c1b8c8415b284aa29f4323b104d8dc83cfb0583 /lib/rpmte.c | |
parent | 05aaf00538be2c561037a76b5a353d7ef8e8194b (diff) | |
download | librpm-tizen-d221895352955d5ee0503855f71c4bc242019273.tar.gz librpm-tizen-d221895352955d5ee0503855f71c4bc242019273.tar.bz2 librpm-tizen-d221895352955d5ee0503855f71c4bc242019273.zip |
Split file state structures + routines out of rpmte to separate sources
- no functional changes
Diffstat (limited to 'lib/rpmte.c')
-rw-r--r-- | lib/rpmte.c | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/lib/rpmte.c b/lib/rpmte.c index c7ae0cbc0..9764c7c1e 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -735,101 +735,3 @@ rpmfs rpmteGetFileStates(rpmte te) { return te->fs; } -rpmfs rpmfsNew(unsigned int fc, rpmElementType type) { - rpmfs fs = xmalloc(sizeof(*fs)); - fs->fc = fc; - fs->replaced = NULL; - fs->states = NULL; - if (type == TR_ADDED) { - fs->states = xmalloc(sizeof(*fs->states) * fs->fc); - memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc); - } - fs->actions = xmalloc(fc * sizeof(*fs->actions)); - memset(fs->actions, FA_UNKNOWN, fc * sizeof(*fs->actions)); - fs->numReplaced = fs->allocatedReplaced = 0; - return fs; -} - -rpmfs rpmfsFree(rpmfs fs) { - fs->replaced = _free(fs->replaced); - fs->states = _free(fs->states); - fs->actions = _free(fs->actions); - - fs = _free(fs); - return fs; -} - -rpm_count_t rpmfsFC(rpmfs fs) { - return fs->fc; -} - -void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum) -{ - if (!fs->replaced) { - fs->replaced = xcalloc(3, sizeof(*fs->replaced)); - fs->allocatedReplaced = 3; - } - if (fs->numReplaced>=fs->allocatedReplaced) { - fs->allocatedReplaced += (fs->allocatedReplaced>>1) + 2; - fs->replaced = xrealloc(fs->replaced, fs->allocatedReplaced*sizeof(*fs->replaced)); - } - fs->replaced[fs->numReplaced].pkgFileNum = pkgFileNum; - fs->replaced[fs->numReplaced].otherPkg = otherPkg; - fs->replaced[fs->numReplaced].otherFileNum = otherFileNum; - - fs->numReplaced++; -} - -sharedFileInfo rpmfsGetReplaced(rpmfs fs) -{ - if (fs && fs->numReplaced) - return fs->replaced; - else - return NULL; -} - -sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced) -{ - if (fs && replaced) { - replaced++; - if (replaced - fs->replaced < fs->numReplaced) - return replaced; - } - return NULL; -} - -void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state) -{ - assert(ix < fs->fc); - fs->states[ix] = state; -} - -rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix) -{ - assert(ix < fs->fc); - if (fs->states) return fs->states[ix]; - return RPMFILE_STATE_MISSING; -} - -rpm_fstate_t * rpmfsGetStates(rpmfs fs) -{ - return fs->states; -} - -rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix) -{ - rpmFileAction action; - if (fs->actions != NULL && ix < fs->fc) { - action = fs->actions[ix]; - } else { - action = FA_UNKNOWN; - } - return action; -} - -void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action) -{ - if (fs->actions != NULL && ix < fs->fc) { - fs->actions[ix] = action; - } -} |