mirror of
https://github.com/NixOS/nix
synced 2025-07-05 08:11:47 +02:00
Use StringMap
instead of std::map<std::string, std::string>
throughout the codebase
This commit is contained in:
parent
8c10104e9e
commit
8ee513379a
26 changed files with 37 additions and 37 deletions
|
@ -72,7 +72,7 @@ void SourceAccessor::dumpPath(
|
|||
|
||||
/* If we're on a case-insensitive system like macOS, undo
|
||||
the case hack applied by restorePath(). */
|
||||
std::map<std::string, std::string> unhacked;
|
||||
StringMap unhacked;
|
||||
for (auto & i : readDirectory(path))
|
||||
if (archiveSettings.useCaseHack) {
|
||||
std::string name(i.first);
|
||||
|
|
|
@ -21,9 +21,9 @@ std::optional<std::string> getEnvNonEmpty(const std::string & key)
|
|||
return value;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> getEnv()
|
||||
StringMap getEnv()
|
||||
{
|
||||
std::map<std::string, std::string> env;
|
||||
StringMap env;
|
||||
for (size_t i = 0; environ[i]; ++i) {
|
||||
auto s = environ[i];
|
||||
auto eq = strchr(s, '=');
|
||||
|
@ -41,7 +41,7 @@ void clearEnv()
|
|||
unsetenv(name.first.c_str());
|
||||
}
|
||||
|
||||
void replaceEnv(const std::map<std::string, std::string> & newEnv)
|
||||
void replaceEnv(const StringMap & newEnv)
|
||||
{
|
||||
clearEnv();
|
||||
for (auto & newEnvVar : newEnv)
|
||||
|
|
|
@ -34,7 +34,7 @@ std::optional<std::string> getEnvNonEmpty(const std::string & key);
|
|||
/**
|
||||
* Get the entire environment.
|
||||
*/
|
||||
std::map<std::string, std::string> getEnv();
|
||||
StringMap getEnv();
|
||||
|
||||
#ifdef _WIN32
|
||||
/**
|
||||
|
@ -64,6 +64,6 @@ void clearEnv();
|
|||
/**
|
||||
* Replace the entire environment with the given one.
|
||||
*/
|
||||
void replaceEnv(const std::map<std::string, std::string> & newEnv);
|
||||
void replaceEnv(const StringMap & newEnv);
|
||||
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ struct RunOptions
|
|||
std::optional<uid_t> gid;
|
||||
#endif
|
||||
std::optional<Path> chdir;
|
||||
std::optional<std::map<std::string, std::string>> environment;
|
||||
std::optional<StringMap> environment;
|
||||
std::optional<std::string> input;
|
||||
Source * standardIn = nullptr;
|
||||
Sink * standardOut = nullptr;
|
||||
|
|
|
@ -10,7 +10,7 @@ struct ParsedURL
|
|||
std::string scheme;
|
||||
std::optional<std::string> authority;
|
||||
std::string path;
|
||||
std::map<std::string, std::string> query;
|
||||
StringMap query;
|
||||
std::string fragment;
|
||||
|
||||
std::string to_string() const;
|
||||
|
@ -30,9 +30,9 @@ MakeError(BadURL, Error);
|
|||
std::string percentDecode(std::string_view in);
|
||||
std::string percentEncode(std::string_view s, std::string_view keep="");
|
||||
|
||||
std::map<std::string, std::string> decodeQuery(const std::string & query);
|
||||
StringMap decodeQuery(const std::string & query);
|
||||
|
||||
std::string encodeQuery(const std::map<std::string, std::string> & query);
|
||||
std::string encodeQuery(const StringMap & query);
|
||||
|
||||
ParsedURL parseURL(const std::string & url);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace nix {
|
||||
|
||||
|
||||
typedef std::map<std::string, std::string> XMLAttrs;
|
||||
typedef std::map<std::string, std::string, std::less<>> XMLAttrs;
|
||||
|
||||
|
||||
class XMLWriter
|
||||
|
|
|
@ -31,9 +31,9 @@ std::optional<Path> getCgroupFS()
|
|||
}
|
||||
|
||||
// FIXME: obsolete, check for cgroup2
|
||||
std::map<std::string, std::string> getCgroups(const Path & cgroupFile)
|
||||
StringMap getCgroups(const Path & cgroupFile)
|
||||
{
|
||||
std::map<std::string, std::string> cgroups;
|
||||
StringMap cgroups;
|
||||
|
||||
for (auto & line : tokenizeString<std::vector<std::string>>(readFile(cgroupFile), "\n")) {
|
||||
static std::regex regex("([0-9]+):([^:]*):(.*)");
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace nix {
|
|||
|
||||
std::optional<Path> getCgroupFS();
|
||||
|
||||
std::map<std::string, std::string> getCgroups(const Path & cgroupFile);
|
||||
StringMap getCgroups(const Path & cgroupFile);
|
||||
|
||||
struct CgroupStats
|
||||
{
|
||||
|
|
|
@ -70,9 +70,9 @@ std::string percentDecode(std::string_view in)
|
|||
return decoded;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> decodeQuery(const std::string & query)
|
||||
StringMap decodeQuery(const std::string & query)
|
||||
{
|
||||
std::map<std::string, std::string> result;
|
||||
StringMap result;
|
||||
|
||||
for (const auto & s : tokenizeString<Strings>(query, "&")) {
|
||||
auto e = s.find('=');
|
||||
|
@ -108,7 +108,7 @@ std::string percentEncode(std::string_view s, std::string_view keep)
|
|||
return res;
|
||||
}
|
||||
|
||||
std::string encodeQuery(const std::map<std::string, std::string> & ss)
|
||||
std::string encodeQuery(const StringMap & ss)
|
||||
{
|
||||
std::string res;
|
||||
bool first = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue