diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-08-11 20:53:28 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-08-11 20:53:28 +0200 |
commit | f7f0d6c7560a8f71707e7852a512469147aa9f84 (patch) | |
tree | 5bec681b4e798a2b35bea180213df399c51920d9 /apt-pkg/cdrom.cc | |
parent | dd6882853b4555a6113740afca417acbaa060043 (diff) |
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.
Diffstat (limited to 'apt-pkg/cdrom.cc')
-rw-r--r-- | apt-pkg/cdrom.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 2a914c665..b8acf0cbe 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -310,7 +310,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List) sort(List.begin(),List.end()); // Collect similar entries - for (vector<string>::iterator I = List.begin(); I != List.end(); I++) + for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) { // Find a space.. string::size_type Space = (*I).find(' '); @@ -322,7 +322,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List) string Word1 = string(*I,Space,SSpace-Space); string Prefix = string(*I,0,Space); - for (vector<string>::iterator J = List.begin(); J != I; J++) + for (vector<string>::iterator J = List.begin(); J != I; ++J) { // Find a space.. string::size_type Space2 = (*J).find(' '); @@ -405,7 +405,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) that were the same. */ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source) { - if (List.size() == 0) + if (List.empty() == true) return true; string File = _config->FindFile("Dir::Etc::sourcelist"); @@ -455,7 +455,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source) if (First == true) { - for (vector<string>::iterator I = List.begin(); I != List.end(); I++) + for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -489,7 +489,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source) // Just in case the file was empty if (First == true) { - for (vector<string>::iterator I = List.begin(); I != List.end(); I++) + for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -661,13 +661,13 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ if (_config->FindB("Debug::aptcdrom",false) == true) { cout << "I found (binary):" << endl; - for (vector<string>::iterator I = List.begin(); I != List.end(); I++) + for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) cout << *I << endl; cout << "I found (source):" << endl; - for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); I++) + for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); ++I) cout << *I << endl; cout << "I found (Signatures):" << endl; - for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); I++) + for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); ++I) cout << *I << endl; } @@ -688,7 +688,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ log->Update(msg.str(), STEP_SCAN); } - if (List.size() == 0 && SourceList.size() == 0) + if (List.empty() == true && SourceList.empty() == true) { if (_config->FindB("APT::CDROM::NoMount",false) == false) UnmountCdrom(CDROM); @@ -712,7 +712,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ { // Escape special characters string::iterator J = Name.begin(); - for (; J != Name.end(); J++) + for (; J != Name.end(); ++J) if (*J == '"' || *J == ']' || *J == '[') *J = '_'; @@ -757,7 +757,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ // Escape special characters string::iterator J = Name.begin(); - for (; J != Name.end(); J++) + for (; J != Name.end(); ++J) if (*J == '"' || *J == ']' || *J == '[') *J = '_'; @@ -804,7 +804,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ if(log != NULL) log->Update(_("Source list entries for this disc are:\n")); - for (vector<string>::iterator I = List.begin(); I != List.end(); I++) + for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -823,7 +823,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ } } - for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); I++) + for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) |