From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 To: devel@lists.altlinux.org References: <20191211234857.GB17949@altlinux.org> <20191212095730.83787-1-darktemplar@altlinux.org> <20191212095730.83787-10-darktemplar@altlinux.org> <20191212225553.e467fee203adc96d3a6060e0@altlinux.org> From: Aleksei Nikiforov Message-ID: <4df9785e-d190-0542-1453-3705816fd757@altlinux.org> Date: Fri, 13 Dec 2019 11:10:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191212225553.e467fee203adc96d3a6060e0@altlinux.org> Content-Type: text/plain; charset=koi8-r; format=flowed Content-Language: ru Content-Transfer-Encoding: 8bit Subject: Re: [devel] [PATCH for apt v2 09/21] Rework identical conditions X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 08:11:09 -0000 Archived-At: List-Archive: List-Post: 12.12.2019 22:55, Andrey Savchenko пишет: > On Thu, 12 Dec 2019 12:57:18 +0300 Aleksei Nikiforov wrote: >> 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 | 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; > > Why this break? It does not look related to the identical > conditions merge. > Thank you. It looks like I missed unrelated change while working on this patch set. I'll split it into a separate patch. >> } >> + } >> 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: > > > Best regards, > Andrew Savchenko > > > _______________________________________________ > Devel mailing list > Devel@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/devel >