This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=4f00cb936f15ee01763e23c5bbfa25cc384cfa88

commit 4f00cb936f15ee01763e23c5bbfa25cc384cfa88
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Sat Feb 1 19:30:15 2020 +0100

    dselect: Reorder branches so that they are not duplicated
    
    Change the branches to alternate, instead of having the last two being
    equal which trigger this warning. This makes the code easier to follow
    as it's symmetric for all cases.
    
    Warned-by: gcc -Wduplicated-branches
---
 debian/changelog     |  2 ++
 dselect/pkgdepcon.cc | 15 ++++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 735083284..df43912e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -186,6 +186,8 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - test: Reformat 200_Dpkg_Shlibs.cpp for coding style conformance.
     - dpkg: Make it possible for the compiler to check printf() format
       string arguments on dependency printer.
+    - dselect: Reorder branches in packagelist::deselect_one_of so that they
+      are not duplicated.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
     - Add a serial versioning to the m4 files.
diff --git a/dselect/pkgdepcon.cc b/dselect/pkgdepcon.cc
index 3b54e7f89..f7c826a0c 100644
--- a/dselect/pkgdepcon.cc
+++ b/dselect/pkgdepcon.cc
@@ -190,14 +190,19 @@ packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, 
dependency *dep)
     best = ed;
   else if (ped->eflag & PKG_EFLAG_REINSTREQ)
     best = er;
-  else if (er->spriority < ed->spriority) best= er; // We'd rather change the
-  else if (er->spriority > ed->spriority) best= ed; // one with the lowest 
priority.
-  // ... failing that the one with the highest priority
-  else if (er->pkg->priority > ed->pkg->priority)
+  // We'd rather change the one with the lowest priority.
+  else if (er->spriority > ed->spriority)
+    best = ed;
+  else if (er->spriority < ed->spriority)
     best = er;
+  // ... failing that the one with the highest priority.
   else if (er->pkg->priority < ed->pkg->priority)
     best = ed;
-  else best= ed;                                      // ... failing that, the 
second
+  else if (er->pkg->priority > ed->pkg->priority)
+    best = er;
+  // ... failing that, the second.
+  else
+    best = ed;
 
   debug(dbg_depcon, "packagelist[%p]::deselect_one_of(): best %s{%d}",
         this, pkg_name(best->pkg, pnaw_always), best->spriority);

-- 
Dpkg.Org's dpkg

Reply via email to