Eliminate stupid fsm->path/opath in FSM_COMMIT now that we can
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Jan 2012 16:05:44 +0000 (18:05 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Jan 2012 16:09:03 +0000 (18:09 +0200)
- 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()

lib/fsm.c

index 7e2afbe..00f3a1d 100644 (file)
--- 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. */