浏览代码

Remove duplicate nested conditional and move its cotents to the outer one

Guillem Jover 19 年之前
父节点
当前提交
826db4452b
共有 2 个文件被更改,包括 13 次插入11 次删除
  1. 5 0
      ChangeLog
  2. 8 11
      src/remove.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2007-09-18  Guillem Jover  <guillem@debian.org>
+
+	* src/remove.c (deferred_remove): Remove duplicate nested conditional,
+	and move its contents to the outer one.
+
 2007-09-14  Brian M. Carlson  <sandals@crustytoothpaste.ath.cx>
 
 	* src/remove.c (deferred_remove): Store the previous package status

+ 8 - 11
src/remove.c

@@ -164,18 +164,15 @@ void deferred_remove(struct pkginfo *pkg) {
   printf(_("Removing %s ...\n"),pkg->name);
   log_action("remove", pkg);
   if (pkg->status == stat_halfconfigured || pkg->status == stat_installed) {
+    static enum pkgstatus oldpkgstatus;
 
-    if (pkg->status == stat_installed || pkg->status == stat_halfconfigured) {
-      static enum pkgstatus oldpkgstatus;
-
-      oldpkgstatus= pkg->status;
-      pkg->status= stat_halfconfigured;
-      modstatdb_note(pkg);
-      push_cleanup(cu_prermremove, ~ehflag_normaltidy, 0, 0, 2,
-                   (void *)pkg, (void *)&oldpkgstatus);
-      maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
-                                  "remove", NULL);
-    }
+    oldpkgstatus= pkg->status;
+    pkg->status= stat_halfconfigured;
+    modstatdb_note(pkg);
+    push_cleanup(cu_prermremove, ~ehflag_normaltidy, 0, 0, 2,
+                 (void *)pkg, (void *)&oldpkgstatus);
+    maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
+                                "remove", NULL);
 
     pkg->status= stat_unpacked; /* Will turn into halfinstalled soon ... */
   }