1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-18 15:01:08 +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:
Graham Christensen 2025-07-18 12:47:27 -04:00
parent 41bf87ec70
commit e4f62e4608
587 changed files with 23258 additions and 23135 deletions

View file

@ -9,19 +9,17 @@
#include <unistd.h>
#ifdef _WIN32
# include <winsock2.h>
# include <afunix.h>
# include <winsock2.h>
# include <afunix.h>
#else
# include <sys/socket.h>
# include <sys/un.h>
# include <sys/socket.h>
# include <sys/un.h>
#endif
namespace nix {
UDSRemoteStoreConfig::UDSRemoteStoreConfig(
std::string_view scheme,
std::string_view authority,
const StoreReference::Params & params)
std::string_view scheme, std::string_view authority, const StoreReference::Params & params)
: Store::Config{params}
, LocalFSStore::Config{params}
, RemoteStore::Config{params}
@ -32,15 +30,13 @@ UDSRemoteStoreConfig::UDSRemoteStoreConfig(
}
}
std::string UDSRemoteStoreConfig::doc()
{
return
#include "uds-remote-store.md"
#include "uds-remote-store.md"
;
}
// A bit gross that we now pass empty string but this is knowing that
// empty string will later default to the same nixDaemonSocketFile. Why
// don't we just wire it all through? I believe there are cases where it
@ -50,7 +46,6 @@ UDSRemoteStoreConfig::UDSRemoteStoreConfig(const Params & params)
{
}
UDSRemoteStore::UDSRemoteStore(ref<const Config> config)
: Store{*config}
, LocalFSStore{*config}
@ -59,25 +54,22 @@ UDSRemoteStore::UDSRemoteStore(ref<const Config> config)
{
}
std::string UDSRemoteStore::getUri()
{
return config->path == settings.nixDaemonSocketFile
? // FIXME: Not clear why we return daemon here and not default
// to settings.nixDaemonSocketFile
//
// unix:// with no path also works. Change what we return?
"daemon"
: std::string(*Config::uriSchemes().begin()) + "://" + config->path;
? // FIXME: Not clear why we return daemon here and not default
// to settings.nixDaemonSocketFile
//
// unix:// with no path also works. Change what we return?
"daemon"
: std::string(*Config::uriSchemes().begin()) + "://" + config->path;
}
void UDSRemoteStore::Connection::closeWrite()
{
shutdown(toSocket(fd.get()), SHUT_WR);
}
ref<RemoteStore::Connection> UDSRemoteStore::openConnection()
{
auto conn = make_ref<Connection>();
@ -93,7 +85,6 @@ ref<RemoteStore::Connection> UDSRemoteStore::openConnection()
return conn;
}
void UDSRemoteStore::addIndirectRoot(const Path & path)
{
auto conn(getConnection());
@ -102,12 +93,11 @@ void UDSRemoteStore::addIndirectRoot(const Path & path)
readInt(conn->from);
}
ref<Store> UDSRemoteStore::Config::openStore() const {
ref<Store> UDSRemoteStore::Config::openStore() const
{
return make_ref<UDSRemoteStore>(ref{shared_from_this()});
}
static RegisterStoreImplementation<UDSRemoteStore::Config> regUDSRemoteStore;
}
} // namespace nix