commit 5dbbd6a82f89e5f1e6e72f097e63db6746c5b5d3
parent ccfb047a612493f9feb30c9c86ff7acdfe79ce53
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 3 Jun 2017 19:56:29 -0400
use std::advance when possible and some slight code cleanup
Diffstat:
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/config.cpp b/src/config.cpp
@@ -193,9 +193,9 @@ void Config::readRemotes()
void Config::writeRemotes()
{
- unsigned int i = 0;
m_remotesIniSize = max((unsigned int)remotes.size(), m_remotesIniSize);
+ unsigned int i = 0;
for(auto it = remotes.begin(); it != remotes.end(); it++, i++)
setString(REMOTES_GRP, ArrayKey(REMOTE_KEY, i), it->toString());
diff --git a/src/package.cpp b/src/package.cpp
@@ -114,9 +114,7 @@ bool Package::addVersion(const Version *ver)
const Version *Package::version(const size_t index) const
{
auto it = m_versions.begin();
-
- for(size_t i = 0; i < index; i++)
- it++;
+ advance(it, index);
return *it;
}
diff --git a/src/path.cpp b/src/path.cpp
@@ -152,9 +152,7 @@ string Path::join(const char sep) const
{
string path;
- for(auto it = m_parts.begin(); it != m_parts.end(); it++) {
- const string &part = *it;
-
+ for(const string &part : m_parts) {
if(!path.empty() || m_absolute)
path += sep ? sep : SEPARATOR;