summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-11-15 17:55:47 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-11-15 17:55:47 +0200
commit4fa662abd1d1f5b5f155a734d0e87aa7e7894ae3 (patch)
tree683000fd0c83068f4e35145a10863e39837543d2
parent170f5bf7d6ce45142cb750d732a625c168c3f524 (diff)
downloadlibrpm-tizen-4fa662abd1d1f5b5f155a734d0e87aa7e7894ae3.tar.gz
librpm-tizen-4fa662abd1d1f5b5f155a734d0e87aa7e7894ae3.tar.bz2
librpm-tizen-4fa662abd1d1f5b5f155a734d0e87aa7e7894ae3.zip
Use rpmpsmNew() + rpmpsmFree() instead of manually doing the same
-rw-r--r--lib/psm.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/psm.c b/lib/psm.c
index 3591b338b..26cf0a1e6 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -231,15 +231,11 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
rpmfi fi = NULL;
char * specFile = NULL;
Header h = NULL;
- struct rpmpsm_s psmbuf;
- rpmpsm psm = &psmbuf;
+ rpmpsm psm = NULL;
int isSource;
rpmRC rpmrc;
int i;
- memset(psm, 0, sizeof(*psm));
- psm->ts = rpmtsLink(ts, RPMDBG_M("InstallSourcePackage"));
-
rpmrc = rpmReadPackageFile(ts, fd, RPMDBG_M("InstallSourcePackage"), &h);
switch (rpmrc) {
case RPMRC_NOTTRUSTED:
@@ -284,11 +280,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
rpmteSetHeader(fi->te, fi->h);
fi->te->fd = fdLink(fd, RPMDBG_M("installSourcePackage"));
-
-(void) rpmInstallLoadMacros(fi, fi->h);
-
- psm->fi = rpmfiLink(fi, RPMDBG_M("rpmInstallLoadMacros"));
- psm->te = fi->te;
+ (void) rpmInstallLoadMacros(fi, fi->h);
if (cookie) {
struct rpmtd_s ctd;
@@ -356,6 +348,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
goto exit;
}
+ psm = rpmpsmNew(ts, fi->te, fi);
psm->goal = PSM_PKGINSTALL;
/* FIX: psm->fi->dnl should be owned. */
@@ -371,9 +364,6 @@ exit:
else
specFile = _free(specFile);
- psm->fi = rpmfiFree(psm->fi);
- psm->te = NULL;
-
if (h != NULL) h = headerFree(h);
if (fi != NULL) {
@@ -388,7 +378,7 @@ exit:
/* XXX nuke the added package(s). */
rpmtsClean(ts);
- psm->ts = rpmtsFree(psm->ts);
+ psm = rpmpsmFree(psm);
return rpmrc;
}