[devel] [PATCH for apt 09/38] Rework identical conditions
Aleksei Nikiforov
darktemplar на altlinux.org
Вт Дек 10 18:23:14 MSK 2019
Found via cppcheck
---
apt/cmdline/apt-shell.cc | 7 +++++--
apt/methods/rsync.cc | 3 ++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/apt/cmdline/apt-shell.cc b/apt/cmdline/apt-shell.cc
index 36fa223..951bc3c 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();
@@ -3053,7 +3054,9 @@ bool DoList(CommandLine &CmdL)
(P->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important)
continue;
status = "locked";
+ break;
}
+ }
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.0
Подробная информация о списке рассылки Devel