From df552ff53e68dff8ca360adbdbea214ece1d08ee Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Feb 2022 16:00:00 +0100 Subject: Remove std::string alias (for real this time) Also use std::string_view in a few more places. --- src/libutil/config.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libutil/config.cc') diff --git a/src/libutil/config.cc b/src/libutil/config.cc index 8e05f1765..9bb412b4f 100644 --- a/src/libutil/config.cc +++ b/src/libutil/config.cc @@ -81,16 +81,16 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string unsigned int pos = 0; while (pos < contents.size()) { - string line; + std::string line; while (pos < contents.size() && contents[pos] != '\n') line += contents[pos++]; pos++; - string::size_type hash = line.find('#'); - if (hash != string::npos) - line = string(line, 0, hash); + auto hash = line.find('#'); + if (hash != std::string::npos) + line = std::string(line, 0, hash); - auto tokens = tokenizeString>(line); + auto tokens = tokenizeString>(line); if (tokens.empty()) continue; if (tokens.size() < 2) @@ -120,7 +120,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string if (tokens[1] != "=") throw UsageError("illegal configuration line '%1%' in '%2%'", line, path); - string name = tokens[0]; + std::string name = tokens[0]; auto i = tokens.begin(); advance(i, 2); @@ -132,7 +132,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string void AbstractConfig::applyConfigFile(const Path & path) { try { - string contents = readFile(path); + std::string contents = readFile(path); applyConfig(contents, path); } catch (SysError &) { } } -- cgit v1.2.3