mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Apply clang-format universally.
* It is tough to contribute to a project that doesn't use a formatter, * It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files * Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose, Let's rip the bandaid off? Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.
This commit is contained in:
parent
41bf87ec70
commit
e4f62e4608
587 changed files with 23258 additions and 23135 deletions
|
|
@ -14,19 +14,19 @@ void checkName(std::string_view name)
|
|||
if (name.size() == 1)
|
||||
throw BadStorePathName("name '%s' is not valid", name);
|
||||
if (name[1] == '-')
|
||||
throw BadStorePathName("name '%s' is not valid: first dash-separated component must not be '%s'", name, ".");
|
||||
throw BadStorePathName(
|
||||
"name '%s' is not valid: first dash-separated component must not be '%s'", name, ".");
|
||||
if (name[1] == '.') {
|
||||
if (name.size() == 2)
|
||||
throw BadStorePathName("name '%s' is not valid", name);
|
||||
if (name[2] == '-')
|
||||
throw BadStorePathName("name '%s' is not valid: first dash-separated component must not be '%s'", name, "..");
|
||||
throw BadStorePathName(
|
||||
"name '%s' is not valid: first dash-separated component must not be '%s'", name, "..");
|
||||
}
|
||||
}
|
||||
for (auto c : name)
|
||||
if (!((c >= '0' && c <= '9')
|
||||
|| (c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| c == '+' || c == '-' || c == '.' || c == '_' || c == '?' || c == '='))
|
||||
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '+' || c == '-'
|
||||
|| c == '.' || c == '_' || c == '?' || c == '='))
|
||||
throw BadStorePathName("name '%s' contains illegal character '%s'", name, c);
|
||||
}
|
||||
|
||||
|
|
@ -45,8 +45,7 @@ StorePath::StorePath(std::string_view _baseName)
|
|||
if (baseName.size() < HashLen + 1)
|
||||
throw BadStorePath("'%s' is too short to be a valid store path", baseName);
|
||||
for (auto c : hashPart())
|
||||
if (c == 'e' || c == 'o' || c == 'u' || c == 't'
|
||||
|| !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')))
|
||||
if (c == 'e' || c == 'o' || c == 'u' || c == 't' || !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')))
|
||||
throw BadStorePath("store path '%s' contains illegal base-32 character '%s'", baseName, c);
|
||||
checkPathName(baseName, name());
|
||||
}
|
||||
|
|
@ -111,7 +110,8 @@ bool MixStoreDirMethods::isStorePath(std::string_view path) const
|
|||
StorePathSet MixStoreDirMethods::parseStorePathSet(const PathSet & paths) const
|
||||
{
|
||||
StorePathSet res;
|
||||
for (auto & i : paths) res.insert(parseStorePath(i));
|
||||
for (auto & i : paths)
|
||||
res.insert(parseStorePath(i));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -123,8 +123,9 @@ std::string MixStoreDirMethods::printStorePath(const StorePath & path) const
|
|||
PathSet MixStoreDirMethods::printStorePathSet(const StorePathSet & paths) const
|
||||
{
|
||||
PathSet res;
|
||||
for (auto & i : paths) res.insert(printStorePath(i));
|
||||
for (auto & i : paths)
|
||||
res.insert(printStorePath(i));
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue