From: Panu Matilainen Date: Fri, 13 Jan 2012 16:05:44 +0000 (+0200) Subject: Eliminate stupid fsm->path/opath in FSM_COMMIT now that we can X-Git-Tag: rpm-4.10.0-beta1~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cc634c7d36b5c50d560bff2ae75f8b7e0f9ee34;p=platform%2Fupstream%2Frpm.git Eliminate stupid fsm->path/opath in FSM_COMMIT now that we can - Now that we can directly operate on temporarily variables instead of having to save-ping-restore-pong them, lets do so... - Also eliminating NULL-checks on the path variables in logging - if either of the paths were NULL we would've already crashed in rename() --- diff --git a/lib/fsm.c b/lib/fsm.c index 7e2afbe..00f3a1d 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -1903,20 +1903,14 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (fsm->osuffix && fsm->diskchecked && (fsm->exists || (fsm->goal == FSM_PKGINSTALL && S_ISREG(st->st_mode)))) { - char * opath = fsm->opath; - char * path = fsm->path; - fsm->opath = fsmFsPath(fsm, st, NULL, NULL); - fsm->path = fsmFsPath(fsm, st, NULL, fsm->osuffix); - rc = fsmRename(fsm->opath, fsm->path, fsm->mapFlags); + char * opath = fsmFsPath(fsm, st, NULL, NULL); + char * path = fsmFsPath(fsm, st, NULL, fsm->osuffix); + rc = fsmRename(opath, path, fsm->mapFlags); if (!rc) { - rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"), - (fsm->opath ? fsm->opath : ""), - (fsm->path ? fsm->path : "")); + rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"), opath, path); } - fsm->path = _free(fsm->path); - fsm->path = path; - fsm->opath = _free(fsm->opath); - fsm->opath = opath; + free(path); + free(opath); } /* Remove erased files. */