#include "system.h"
+#include <rpm/header.h>
#include "lib/rpmfs.h"
#include "debug.h"
int allocatedReplaced;
};
-rpmfs rpmfsNew(unsigned int fc, rpmElementType type)
+rpmfs rpmfsNew(Header h, rpmElementType type)
{
+ struct rpmtd_s bnames;
rpmfs fs = xcalloc(1, sizeof(*fs));
- fs->fc = fc;
- fs->actions = xmalloc(fc * sizeof(*fs->actions));
- memset(fs->actions, FA_UNKNOWN, fc * sizeof(*fs->actions));
+
+ headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
+ fs->fc = rpmtdCount(&bnames);
+ rpmtdFreeData(&bnames);
+
+ fs->actions = xmalloc(fs->fc * sizeof(*fs->actions));
+ memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
if (type == TR_ADDED) {
fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
};
RPM_GNUC_INTERNAL
-rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
+rpmfs rpmfsNew(Header h, rpmElementType type);
RPM_GNUC_INTERNAL
rpmfs rpmfsFree(rpmfs fs);
p->conflicts = rpmdsNew(h, RPMTAG_CONFLICTNAME, 0);
p->obsoletes = rpmdsNew(h, RPMTAG_OBSOLETENAME, 0);
- {
- // get number of files by hand as rpmfiNew needs p->fs
- struct rpmtd_s bnames;
- headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
-
- p->fs = rpmfsNew(rpmtdCount(&bnames), p->type);
-
- rpmtdFreeData(&bnames);
- }
+ p->fs = rpmfsNew(h, p->type);
p->fi = getFI(p, h);
/* See if we have pre/posttrans scripts. */