mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
Merge remote-tracking branch 'origin/master' into external-derivation-builder
This commit is contained in:
commit
e7e2ac97f8
62 changed files with 751 additions and 950 deletions
|
|
@ -222,22 +222,3 @@ public:
|
|||
};
|
||||
|
||||
} // namespace nix
|
||||
|
||||
template<>
|
||||
struct std::hash<nix::Hash>
|
||||
{
|
||||
std::size_t operator()(const nix::Hash & hash) const noexcept
|
||||
{
|
||||
assert(hash.hashSize > sizeof(size_t));
|
||||
return *reinterpret_cast<const std::size_t *>(&hash.hash);
|
||||
}
|
||||
};
|
||||
|
||||
namespace nix {
|
||||
|
||||
inline std::size_t hash_value(const Hash & hash)
|
||||
{
|
||||
return std::hash<Hash>{}(hash);
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -12,11 +12,6 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/*
|
||||
* workaround for unavailable view() method (C++20) of std::ostringstream under MacOS with clang-16
|
||||
*/
|
||||
std::string_view toView(const std::ostringstream & os);
|
||||
|
||||
/**
|
||||
* String tokenizer.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public:
|
|||
std::ostringstream oss;
|
||||
showErrorInfo(oss, ei, loggerSettings.showTrace.get());
|
||||
|
||||
log(ei.level, toView(oss));
|
||||
log(ei.level, oss.view());
|
||||
}
|
||||
|
||||
void startActivity(
|
||||
|
|
|
|||
|
|
@ -8,23 +8,6 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
struct view_stringbuf : public std::stringbuf
|
||||
{
|
||||
inline std::string_view toView()
|
||||
{
|
||||
auto begin = pbase();
|
||||
return {begin, begin + pubseekoff(0, std::ios_base::cur, std::ios_base::out)};
|
||||
}
|
||||
};
|
||||
|
||||
__attribute__((no_sanitize("undefined"))) std::string_view toView(const std::ostringstream & os)
|
||||
{
|
||||
/* Downcasting like this is very much undefined behavior, so we disable
|
||||
UBSAN for this function. */
|
||||
auto buf = static_cast<view_stringbuf *>(os.rdbuf());
|
||||
return buf->toView();
|
||||
}
|
||||
|
||||
template std::list<std::string> tokenizeString(std::string_view s, std::string_view separators);
|
||||
template StringSet tokenizeString(std::string_view s, std::string_view separators);
|
||||
template std::vector<std::string> tokenizeString(std::string_view s, std::string_view separators);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue