Lose unused fdigests array from rpmfi struct

- only used in rpmfiNew() where it's converted to binary from the header
  hex presentation and free'd immediately, a local variable will do just as
  well
- some useless references in fsm and psm, kill'em too
This commit is contained in:
Panu Matilainen 2008-05-29 16:26:21 +03:00
parent ea134adf81
commit ae5667cf06
5 changed files with 8 additions and 17 deletions

View File

@ -721,10 +721,8 @@ int fsmMapAttrs(FSM_t fsm)
*/
if (ts != NULL && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOMD5)) {
size_t diglen = rpmDigestLength(fsm->digestalgo);
fsm->fdigest = (fi->fdigests ? fi->fdigests[i] : NULL);
fsm->digest = (char *)(fi->digests ? (fi->digests + (diglen * i)) : NULL);
} else {
fsm->fdigest = NULL;
fsm->digest = NULL;
}
}
@ -748,7 +746,7 @@ static int expandRegular(FSM_t fsm)
if (rc)
goto exit;
if (st->st_size > 0 && (fsm->fdigest != NULL || fsm->digest != NULL))
if (st->st_size > 0 && fsm->digest != NULL)
fdInitDigest(fsm->wfd, fsm->digestalgo, 0);
while (left) {
@ -769,7 +767,7 @@ static int expandRegular(FSM_t fsm)
(void) fsmNext(fsm, FSM_NOTIFY);
}
if (st->st_size > 0 && (fsm->fdigest || fsm->digest)) {
if (st->st_size > 0 && fsm->digest) {
void * digest = NULL;
int asAscii = (fsm->digest == NULL ? 1 : 0);
@ -786,8 +784,7 @@ static int expandRegular(FSM_t fsm)
if (memcmp(digest, fsm->digest, diglen))
rc = CPIOERR_MD5SUM_MISMATCH;
} else {
if (strcmp(digest, fsm->fdigest))
rc = CPIOERR_MD5SUM_MISMATCH;
rc = CPIOERR_MD5SUM_MISMATCH;
}
digest = _free(digest);
}

View File

@ -152,7 +152,6 @@ struct fsm_s {
cpioMapFlags mapFlags; /*!< Bit(s) to control mapping. */
const char * dirName; /*!< File directory name. */
const char * baseName; /*!< File base name. */
const char * fdigest; /*!< Hex checksum (NULL disables). */
const char * digest; /*!< Binary checksum (NULL disables). */
const char * fcontext; /*!< File security context (NULL disables). */
pgpHashAlgo digestalgo; /*!< File checksum algorithm */

View File

@ -303,9 +303,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
*cookie = xstrdup(*cookie);
}
/* XXX FIXME: can't do endian neutral MD5 verification yet. */
fi->fdigests = hfd(fi->fdigests, RPM_FORCEFREE_TYPE);
/* XXX FIXME: don't do per-file mapping, force global flags. */
fi->fmapflags = _free(fi->fmapflags);
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;

View File

@ -1105,7 +1105,6 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc);
fi->flinks = hfd(fi->flinks, RPM_FORCEFREE_TYPE);
fi->flangs = hfd(fi->flangs, RPM_FORCEFREE_TYPE);
fi->fdigests = hfd(fi->fdigests, RPM_FORCEFREE_TYPE);
fi->digests = _free(fi->digests);
fi->cdict = hfd(fi->cdict, RPM_FORCEFREE_TYPE);
@ -1179,6 +1178,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem)
uint32_t * uip;
int dnlmax, bnlmax;
unsigned char * t;
const char **fdigests;
int len;
int xx;
int i;
@ -1268,11 +1268,10 @@ if (fi->actions == NULL)
/* digest algorithm hardwired to MD5 for now */
fi->digestalgo = PGPHASHALGO_MD5;
fi->fdigests = NULL;
xx = hge(h, RPMTAG_FILEMD5S, NULL, (rpm_data_t *) &fi->fdigests, NULL);
xx = hge(h, RPMTAG_FILEMD5S, NULL, (rpm_data_t *) &fdigests, NULL);
fi->digests = NULL;
if (fi->fdigests) {
if (fdigests) {
size_t diglen = rpmDigestLength(fi->digestalgo);
t = xmalloc(fi->fc * diglen);
fi->digests = t;
@ -1280,7 +1279,7 @@ if (fi->actions == NULL)
const char * fdigest;
int j;
fdigest = fi->fdigests[i];
fdigest = fdigests[i];
if (!(fdigest && *fdigest != '\0')) {
memset(t, 0, diglen);
t += diglen;
@ -1289,7 +1288,7 @@ if (fi->actions == NULL)
for (j = 0; j < diglen; j++, t++, fdigest += 2)
*t = (rnibble(fdigest[0]) << 4) | rnibble(fdigest[1]);
}
fi->fdigests = hfd(fi->fdigests, RPM_FORCEFREE_TYPE);
fdigests = hfd(fdigests, RPM_FORCEFREE_TYPE);
}
/* XXX TR_REMOVED doesn;t need fmtimes, frdevs, finodes, or fcontexts */

View File

@ -35,7 +35,6 @@ struct rpmfi_s {
/*?null?*/
const char ** dnl; /*!< Directory name(s) (from header) */
const char ** fdigests; /*!< File checksum(s) (from header) */
const char ** flinks; /*!< File link(s) (from header) */
const char ** flangs; /*!< File lang(s) (from header) */