[devel] [PATCH for apt v3 09/21] Rework identical conditions

Aleksei Nikiforov darktemplar на altlinux.org
Пт Дек 13 11:21:59 MSK 2019


Found via cppcheck:
[apt/methods/rsync.cc:371] -> [apt/methods/rsync.cc:373]:
(style) The if condition is the same as the previous if condition
---
 apt/cmdline/apt-shell.cc | 6 ++++--
 apt/methods/rsync.cc     | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/apt/cmdline/apt-shell.cc b/apt/cmdline/apt-shell.cc
index 36fa223..26811c4 100644
--- a/apt/cmdline/apt-shell.cc
+++ b/apt/cmdline/apt-shell.cc
@@ -3044,8 +3044,9 @@ bool DoList(CommandLine &CmdL)
 	    PkgSection = Pkg.Section();
 	    StrLen = strlen(Str);
     	    string status = "available";
-	    if (Pkg->CurrentVer != 0) status = "installed";
-            if (Pkg->CurrentVer != 0)
+	    if (Pkg->CurrentVer != 0)
+	    {
+	        status = "installed";
               for (pkgCache::DepIterator D = Pkg.RevDependsList(); not D.end(); ++D)
                {
 	          pkgCache::PkgIterator P = D.ParentPkg();
@@ -3054,6 +3055,7 @@ bool DoList(CommandLine &CmdL)
 	             continue;
 	          status = "locked";
                }
+	    }
 	    if (Pkg->CurrentVer != 0 && Cache[Pkg].Upgradable() == true) status = "upgradable";
 	    if (Cache[Pkg].NewInstall()) status = "be-installed";
 	    if (Cache[Pkg].Delete()) status = "be-removed";
diff --git a/apt/methods/rsync.cc b/apt/methods/rsync.cc
index bae22eb..64c9231 100644
--- a/apt/methods/rsync.cc
+++ b/apt/methods/rsync.cc
@@ -369,9 +369,10 @@ bool RsyncMethod::RsyncConnExec::Get(pkgAcqMethod *Owner, FetchResult &FRes, con
 	  return false;
    }
    if ( RsyncMethod::Debug )
+   {
 	  cerr << "RSYNC: Created pipe [" << p[0] << ',' << p[1] << ']' << endl;
-   if ( RsyncMethod::Debug )
 	  cerr << "RSYNC: Starting: " << string(argv) << endl;
+   }
 
    switch ( ChildPid = fork() ) {
 	  case -1:
-- 
2.24.1



Подробная информация о списке рассылки Devel