summaryrefslogtreecommitdiff
path: root/lib/psm.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-06-13 11:42:06 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-06-13 11:42:06 +0300
commitd23f3a67c73ff7789c4b6dea6f05f8b394abe3c6 (patch)
tree587fd279a91c030e418e39713d132c6e3844d1a2 /lib/psm.c
parentfe87b4a5cf101919ad8d3aa16fb1561fe0b5e4d8 (diff)
downloadrpm-d23f3a67c73ff7789c4b6dea6f05f8b394abe3c6.tar.gz
rpm-d23f3a67c73ff7789c4b6dea6f05f8b394abe3c6.tar.bz2
rpm-d23f3a67c73ff7789c4b6dea6f05f8b394abe3c6.zip
Convert rpmpsmStage() to new headerGet()
- grabbing fi->fuser and fi->fgroup there seem completely unnecessary, they're always populated from rpmfiNew() afaict... - hfd() with FORCEFREE is just the same as _free()...
Diffstat (limited to 'lib/psm.c')
-rw-r--r--lib/psm.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/psm.c b/lib/psm.c
index a2ec5de39..4d2bf24e9 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -20,7 +20,7 @@
#include "lib/cpio.h"
#include "lib/fsm.h" /* XXX CPIO_FOO/FSM_FOO constants */
#include "lib/psm.h"
-#include "lib/rpmfi_internal.h" /* XXX replaced/states, fi->hge, fi->te... */
+#include "lib/rpmfi_internal.h" /* XXX replaced/states, fi->te... */
#include "lib/rpmte_internal.h" /* XXX te->fd */
#include "lib/rpmlead.h" /* writeLead proto */
#include "lib/signature.h" /* signature constants */
@@ -1222,8 +1222,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
const rpmts ts = psm->ts;
rpm_color_t tscolor = rpmtsColor(ts);
rpmfi fi = psm->fi;
- HGE_t hge = fi->hge;
- HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
+ headerGetFlags hgflags = fi->h ? HEADERGET_MINMEM : HEADERGET_ALLOC;
rpmRC rc = psm->rc;
int saveerrno;
int xx;
@@ -1290,9 +1289,13 @@ assert(psm->mi == NULL);
* prefix stripped to form the cpio list, while all other packages
* need the leading / stripped.
*/
- { const char * p;
- xx = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (rpm_data_t *) &p, NULL);
- fi->striplen = (xx ? strlen(p) + 1 : 1);
+ { const char * p = NULL;
+ struct rpmtd_s dprefix;
+ if (headerGet(fi->h, RPMTAG_DEFAULTPREFIX, &dprefix,
+ HEADERGET_MINMEM)) {
+ p = rpmtdGetString(&dprefix);
+ }
+ fi->striplen = p ? strlen(p) + 1 : 1;
}
fi->mapflags =
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID | (fi->mapflags & CPIO_SBIT_CHECK);
@@ -1306,12 +1309,17 @@ assert(psm->mi == NULL);
fi->apath = filenames.data; /* Ick.. */
}
- if (fi->fuser == NULL)
- xx = hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
- (rpm_data_t *) &fi->fuser, NULL);
- if (fi->fgroup == NULL)
- xx = hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
- (rpm_data_t *) &fi->fgroup, NULL);
+ /* XXX AFAICT these are "can't happen" cases... */
+ if (fi->fuser == NULL) {
+ struct rpmtd_s fuser;
+ headerGet(fi->h, RPMTAG_FILEUSERNAME, &fuser, hgflags);
+ fi->fuser = fuser.data;
+ }
+ if (fi->fgroup == NULL) {
+ struct rpmtd_s fgroup;
+ headerGet(fi->h, RPMTAG_FILEGROUPNAME, &fgroup, hgflags);
+ fi->fgroup = fgroup.data;
+ }
rc = RPMRC_OK;
}
if (psm->goal == PSM_PKGERASE) {
@@ -1595,8 +1603,8 @@ assert(psm->mi == NULL);
}
psm->failedFile = _free(psm->failedFile);
- fi->fgroup = hfd(fi->fgroup, RPM_FORCEFREE_TYPE);
- fi->fuser = hfd(fi->fuser, RPM_FORCEFREE_TYPE);
+ fi->fgroup = _free(fi->fgroup);
+ fi->fuser = _free(fi->fuser);
fi->apath = _free(fi->apath);
fi->fstates = _free(fi->fstates);
break;