The following commit has been merged in the master branch:
commit 10960fcbe949640779ed5afaaaa5eb4e72897ff8
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 5 10:24:45 2011 +0100

    dpkg: Reduce the scope of a if/else in setforce()

diff --git a/src/main.c b/src/main.c
index d6a4d56..3dd6afc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -472,19 +472,20 @@ static void setforce(const struct cmdinfo *cip, const 
char *value) {
     l = comma ? (size_t)(comma - value) : strlen(value);
     for (fip=forceinfos; fip->name; fip++)
       if (!strncmp(fip->name,value,l) && strlen(fip->name)==l) break;
+
     if (!fip->name) {
       badusage(_("unknown force/refuse option `%.*s'"),
                (int)min(l, 250), value);
+    } else if (strcmp(fip->name, "all") == 0) {
+      for (fip = forceinfos; fip->name; fip++)
+        if (fip->opt)
+          *fip->opt = cip->arg;
+    } else if (fip->opt) {
+      *fip->opt = cip->arg;
     } else {
-      if (strcmp("all", fip->name) == 0) {
-       for (fip=forceinfos; fip->name; fip++)
-         if (fip->opt)
-           *fip->opt= cip->arg;
-      } else if (fip->opt)
-       *fip->opt= cip->arg;
-      else
-       warning(_("obsolete force/refuse option '%s'\n"), fip->name);
+      warning(_("obsolete force/refuse option '%s'\n"), fip->name);
     }
+
     if (!comma) break;
     value= ++comma;
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to