From b40b7c380acbdcd84338bdcd253df32f1ef79ed8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Aug 2011 18:42:19 +0200 Subject: cppcheck is right that the check for preventing null deference of Query is redundant in Redirect() as we can't reach the code with null anyway [apt-pkg/acquire-method.cc:433]: (error) Possible null pointer dereference: Queue - otherwise it is redundant to check if Queue is null at line 425 --- apt-pkg/acquire-method.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'apt-pkg/acquire-method.cc') diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index e9e102488..79a7519a8 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -421,12 +421,8 @@ void pkgAcqMethod::Status(const char *Format,...) to keep the pipeline synchronized. */ void pkgAcqMethod::Redirect(const string &NewURI) { - std::cout << "103 Redirect\nURI: "; - if (Queue != 0) - std::cout << Queue->Uri << "\n"; - else - std::cout << "\n"; - std::cout << "New-URI: " << NewURI << "\n" + std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n" + << "New-URI: " << NewURI << "\n" << "\n" << std::flush; // Change the URI for the request. -- cgit v1.2.3 From f7f0d6c7560a8f71707e7852a512469147aa9f84 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Aug 2011 20:53:28 +0200 Subject: cppcheck complains about some possible speed improvements which could be done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types. --- apt-pkg/acquire-method.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/acquire-method.cc') diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 79a7519a8..7e9061e56 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -81,7 +81,7 @@ void pkgAcqMethod::Fail(bool Transient) void pkgAcqMethod::Fail(string Err,bool Transient) { // Strip out junk from the error messages - for (string::iterator I = Err.begin(); I != Err.end(); I++) + for (string::iterator I = Err.begin(); I != Err.end(); ++I) { if (*I == '\r') *I = ' '; -- cgit v1.2.3