aboutsummaryrefslogtreecommitdiff
path: root/src/nix-channel
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-02-25 16:00:00 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-02-25 16:13:02 +0100
commitdf552ff53e68dff8ca360adbdbea214ece1d08ee (patch)
tree9ed3cb700377d4731b4c234ebec16efb0099c71a /src/nix-channel
parent14b38d0887f8a8d6b75039113eface57cfb19d06 (diff)
Remove std::string alias (for real this time)
Also use std::string_view in a few more places.
Diffstat (limited to 'src/nix-channel')
-rwxr-xr-xsrc/nix-channel/nix-channel.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc
index eae15885a..f46b90b90 100755
--- a/src/nix-channel/nix-channel.cc
+++ b/src/nix-channel/nix-channel.cc
@@ -11,7 +11,7 @@
using namespace nix;
-typedef std::map<string,string> Channels;
+typedef std::map<std::string, std::string> Channels;
static Channels channels;
static Path channelsList;
@@ -22,11 +22,11 @@ static void readChannels()
if (!pathExists(channelsList)) return;
auto channelsFile = readFile(channelsList);
- for (const auto & line : tokenizeString<std::vector<string>>(channelsFile, "\n")) {
+ for (const auto & line : tokenizeString<std::vector<std::string>>(channelsFile, "\n")) {
chomp(line);
if (std::regex_search(line, std::regex("^\\s*\\#")))
continue;
- auto split = tokenizeString<std::vector<string>>(line, " ");
+ auto split = tokenizeString<std::vector<std::string>>(line, " ");
auto url = std::regex_replace(split[0], std::regex("/*$"), "");
auto name = split.size() > 1 ? split[1] : std::string(baseNameOf(url));
channels[name] = url;
@@ -44,7 +44,7 @@ static void writeChannels()
}
// Adds a channel.
-static void addChannel(const string & url, const string & name)
+static void addChannel(const std::string & url, const std::string & name)
{
if (!regex_search(url, std::regex("^(file|http|https)://")))
throw Error("invalid channel URL '%1%'", url);
@@ -58,7 +58,7 @@ static void addChannel(const string & url, const string & name)
static Path profile;
// Remove a channel.
-static void removeChannel(const string & name)
+static void removeChannel(const std::string & name)
{
readChannels();
channels.erase(name);
@@ -96,7 +96,7 @@ static void update(const StringSet & channelNames)
std::smatch match;
auto urlBase = std::string(baseNameOf(url));
if (std::regex_search(urlBase, match, std::regex("(-\\d.*)$")))
- cname = cname + (string) match[1];
+ cname = cname + (std::string) match[1];
std::string extraAttrs;
@@ -176,7 +176,7 @@ static int main_nix_channel(int argc, char ** argv)
cUpdate,
cRollback
} cmd = cNone;
- std::vector<string> args;
+ std::vector<std::string> args;
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--help") {
showManPage("nix-channel");