Procházet zdrojové kódy

Refactor returning code in deppossi_ok_found

Ian Jackson před 18 roky
rodič
revize
043da257ab
2 změnil soubory, kde provedl 17 přidání a 8 odebrání
  1. 4 0
      ChangeLog
  2. 13 8
      src/packages.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-03-28  Ian Jackson  <ian@davenant.greenend.org.uk>
+
+	* src/packages.c (deppossi_ok_found): Refactor returning code.
+
 2008-03-28  Ian Jackson  <ian@davenant.greenend.org.uk>
 
 	* src/depcon.c (depisok): Improve whynot message by stating when a

+ 13 - 8
src/packages.c

@@ -335,10 +335,8 @@ static int deppossi_ok_found(struct pkginfo *possdependee,
 		     possdependee->name);
       }
 
-      if (fc_depends) thisf= (dependtry >= 4) ? 2 : 1;
-      debug(dbg_depcondetail,"      not configured/able - returning %d",thisf);
-      (*interestingwarnings)++;
-      return thisf;
+      debug(dbg_depcondetail, "      not configured/able");
+      goto unsuitable;
     }
   default:
     if (providing) {
@@ -350,11 +348,18 @@ static int deppossi_ok_found(struct pkginfo *possdependee,
 		   possdependee->name);
     }
 
-    if (fc_depends) thisf= (dependtry >= 4) ? 2 : 1;
-    debug(dbg_depcondetail,"      not installed - returning %d",thisf);
-    (*interestingwarnings)++;
-    return thisf;
+    debug(dbg_depcondetail, "      not installed");
+    goto unsuitable;
   }
+
+unsuitable:
+  if (fc_depends)
+    thisf = (dependtry >= 4) ? 2 : 1;
+
+  debug(dbg_depcondetail, "        returning %d", thisf);
+  (*interestingwarnings)++;
+
+  return thisf;
 }
 
 static void breaks_check_one(struct varbuf *aemsgs, int *ok,