fi->actions = _free(fi->actions);
fi->replacedSizes = _free(fi->replacedSizes);
fi->replaced = _free(fi->replaced);
+ fi->numReplaced = 0;
+ fi->allocatedReplaced = 0;
fi->h = headerFree(fi->h);
if (fi == NULL) /* XXX can't happen */
goto exit;
+ fi->replaced = NULL;
+ fi->numReplaced = fi->allocatedReplaced = 0;
+
fi->magic = RPMFIMAGIC;
fi->Type = Type;
fi->i = -1;
return rsize;
}
+void rpmfiAddReplaced(rpmfi fi, int pkgFileNum, int otherPkg, int otherFileNum)
+{
+ if (!fi->replaced) {
+ fi->replaced = xcalloc(3, sizeof(*fi->replaced));
+ fi->allocatedReplaced = 3;
+ }
+ if (fi->numReplaced>=fi->allocatedReplaced) {
+ fi->allocatedReplaced += (fi->allocatedReplaced>>1) + 2;
+ fi->replaced = xrealloc(fi->replaced, fi->allocatedReplaced*sizeof(*fi->replaced));
+ }
+ fi->replaced[fi->numReplaced].pkgFileNum = pkgFileNum;
+ fi->replaced[fi->numReplaced].otherPkg = otherPkg;
+ fi->replaced[fi->numReplaced].otherFileNum = otherFileNum;
+
+ fi->numReplaced++;
+}
+
+sharedFileInfo rpmfiGetReplaced(rpmfi fi)
+{
+ if (fi && fi->numReplaced)
+ return fi->replaced;
+ else
+ return NULL;
+}
+
+sharedFileInfo rpmfiNextReplaced(rpmfi fi , sharedFileInfo replaced)
+{
+ if (fi && replaced) {
+ replaced++;
+ if (replaced - fi->replaced < fi->numReplaced)
+ return replaced;
+ }
+ return NULL;
+}
+
FSM_t rpmfiFSM(rpmfi fi)
{
if (fi != NULL && fi->fsm == NULL) {
*/
struct sharedFileInfo_s {
int pkgFileNum;
- int otherFileNum;
int otherPkg;
- int isRemoved;
+ int otherFileNum;
};
/*
char ** apath;
FSM_t fsm; /*!< File state machine data. */
sharedFileInfo replaced; /*!< (TR_ADDED) */
+ int numReplaced;
+ int allocatedReplaced;
rpm_off_t * replacedSizes; /*!< (TR_ADDED) */
int magic;
#define RPMFIMAGIC 0x09697923
RPM_GNUC_INTERNAL
rpm_loff_t rpmfiFReplacedSize(rpmfi fi);
+RPM_GNUC_INTERNAL
+void rpmfiAddReplaced(rpmfi fi, int pkgFileNum, int otherPkg, int otherFileNum);
+
+RPM_GNUC_INTERNAL
+sharedFileInfo rpmfiGetReplaced(rpmfi fi);
+
+RPM_GNUC_INTERNAL
+sharedFileInfo rpmfiNextReplaced(rpmfi fi , sharedFileInfo replaced);
+
/* XXX can't be internal as build code needs this */
FSM_t rpmfiFSM(rpmfi fi);
#endif /* _RPMFI_INTERNAL_H */