struct rpmtd_s bnames;
headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
- p->fs = rpmfsNew(rpmtdCount(&bnames));
+ p->fs = rpmfsNew(rpmtdCount(&bnames), p->type);
rpmtdFreeData(&bnames);
}
return te->fs;
}
-rpmfs rpmfsNew(unsigned int fc) {
+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;
void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state)
{
assert(ix < fs->fc);
- if (fs->states == NULL) {
- fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
- memset(fs->states, RPMFILE_STATE_MISSING, fs->fc);
- }
fs->states[ix] = state;
}
rpmfs rpmteGetFileStates(rpmte te);
RPM_GNUC_INTERNAL
-rpmfs rpmfsNew(unsigned int fc);
+rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
RPM_GNUC_INTERNAL
rpmfs rpmfsFree(rpmfs fs);