Add internal rpmfi apis to deal with fingerprints, use them
This commit is contained in:
parent
fe5e906ab2
commit
897bbbd708
|
@ -246,7 +246,7 @@ void fpLookupSubdir(rpmFpHash symlinks, rpmFpHash fphash, fingerPrintCache fpc,
|
|||
struct rpmffi_s * recs;
|
||||
int numRecs;
|
||||
int i, fiFX;
|
||||
fingerPrint *fp = fi->fps + filenr;
|
||||
fingerPrint *fp = rpmfiFpsIndex(fi, filenr);
|
||||
int symlinkcount = 0;
|
||||
struct rpmffi_s ffi = { p, filenr};
|
||||
|
||||
|
|
16
lib/rpmfi.c
16
lib/rpmfi.c
|
@ -471,6 +471,15 @@ const char * rpmfiFLangsIndex(rpmfi fi, int ix)
|
|||
return flangs;
|
||||
}
|
||||
|
||||
struct fingerPrint_s *rpmfiFpsIndex(rpmfi fi, int ix)
|
||||
{
|
||||
struct fingerPrint_s * fps = NULL;
|
||||
if (fi != NULL && fi->fps != NULL && ix >= 0 && ix < fi->fc) {
|
||||
fps = fi->fps + ix;
|
||||
}
|
||||
return fps;
|
||||
}
|
||||
|
||||
int rpmfiNext(rpmfi fi)
|
||||
{
|
||||
int i = -1;
|
||||
|
@ -1459,6 +1468,13 @@ rpm_loff_t rpmfiFReplacedSize(rpmfi fi)
|
|||
return rsize;
|
||||
}
|
||||
|
||||
void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
|
||||
{
|
||||
if (fi->fc > 0 && fi->fps == NULL) {
|
||||
fi->fps = xcalloc(fi->fc, sizeof(*fi->fps));
|
||||
}
|
||||
fpLookupList(fpc, fi->dnl, fi->bnl, fi->dil, fi->fc, fi->fps);
|
||||
}
|
||||
|
||||
FSM_t rpmfiFSM(rpmfi fi)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <rpm/header.h>
|
||||
#include <rpm/rpmfi.h>
|
||||
#include "lib/fsm.h" /* for FSM_t */
|
||||
|
||||
#include "lib/fprint.h"
|
||||
|
||||
/*
|
||||
* This limits maximum unique strings (user + group names) from packages to
|
||||
|
@ -160,12 +160,18 @@ const char * rpmfiFGroupIndex(rpmfi fi, int ix);
|
|||
RPM_GNUC_INTERNAL
|
||||
const char * rpmfiFCapsIndex(rpmfi fi, int ix);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
struct fingerPrint_s *rpmfiFpsIndex(rpmfi fi, int ix);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
rpm_loff_t rpmfiFReplacedSize(rpmfi fi);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc);
|
||||
|
||||
/* XXX can't be internal as build code needs this */
|
||||
FSM_t rpmfiFSM(rpmfi fi);
|
||||
#endif /* _RPMFI_INTERNAL_H */
|
||||
|
|
|
@ -158,7 +158,7 @@ static void handleOverlappedFiles(const rpmts ts, const rpmte p, rpmfi fi)
|
|||
continue;
|
||||
|
||||
fn = rpmfiFN(fi);
|
||||
fiFps = fi->fps + i;
|
||||
fiFps = rpmfiFpsIndex(fi, i);
|
||||
FFlags = rpmfiFFlags(fi);
|
||||
FMode = rpmfiFMode(fi);
|
||||
FColor = rpmfiFColor(fi);
|
||||
|
@ -1102,8 +1102,6 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
|
|||
numRemoved++;
|
||||
break;
|
||||
}
|
||||
|
||||
fi->fps = (fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL);
|
||||
}
|
||||
pi = rpmtsiFree(pi);
|
||||
|
||||
|
@ -1140,7 +1138,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
|
|||
fc = rpmfiFC(fi);
|
||||
|
||||
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0);
|
||||
fpLookupList(fpc, fi->dnl, fi->bnl, fi->dil, fc, fi->fps);
|
||||
rpmfiFpLookup(fi, fpc);
|
||||
/* collect symbolic links */
|
||||
fi = rpmfiInit(fi, 0);
|
||||
if (fi != NULL) /* XXX lclint */
|
||||
|
@ -1154,7 +1152,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
|
|||
continue;
|
||||
ffi.p = p;
|
||||
ffi.fileno = i;
|
||||
rpmFpHashAddEntry(symlinks, fi->fps + i, ffi);
|
||||
rpmFpHashAddEntry(symlinks, rpmfiFpsIndex(fi, i), ffi);
|
||||
}
|
||||
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), fc);
|
||||
|
||||
|
|
Loading…
Reference in New Issue