mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +02:00
Slightly change formatting style
For long expressions, one argument or parameter per line is just easier.
This commit is contained in:
parent
bd7a074636
commit
1d6c2316a9
6 changed files with 44 additions and 15 deletions
|
@ -30,3 +30,5 @@ BreakBeforeBinaryOperators: NonAssignment
|
||||||
AlwaysBreakBeforeMultilineStrings: true
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
IndentPPDirectives: AfterHash
|
IndentPPDirectives: AfterHash
|
||||||
PPIndentWidth: 2
|
PPIndentWidth: 2
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
|
|
@ -25,7 +25,10 @@ static StringSet getExcludingNoProxyVariables()
|
||||||
static const StringSet excludeVariables{"no_proxy", "NO_PROXY"};
|
static const StringSet excludeVariables{"no_proxy", "NO_PROXY"};
|
||||||
StringSet variables;
|
StringSet variables;
|
||||||
std::set_difference(
|
std::set_difference(
|
||||||
networkProxyVariables.begin(), networkProxyVariables.end(), excludeVariables.begin(), excludeVariables.end(),
|
networkProxyVariables.begin(),
|
||||||
|
networkProxyVariables.end(),
|
||||||
|
excludeVariables.begin(),
|
||||||
|
excludeVariables.end(),
|
||||||
std::inserter(variables, variables.begin()));
|
std::inserter(variables, variables.begin()));
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,13 @@ void PathLocks::unlock()
|
||||||
AutoCloseFD openLockFile(const Path & path, bool create)
|
AutoCloseFD openLockFile(const Path & path, bool create)
|
||||||
{
|
{
|
||||||
AutoCloseFD desc = CreateFileA(
|
AutoCloseFD desc = CreateFileA(
|
||||||
path.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
path.c_str(),
|
||||||
create ? OPEN_ALWAYS : OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_POSIX_SEMANTICS, NULL);
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
NULL,
|
||||||
|
create ? OPEN_ALWAYS : OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_POSIX_SEMANTICS,
|
||||||
|
NULL);
|
||||||
if (desc.get() == INVALID_HANDLE_VALUE)
|
if (desc.get() == INVALID_HANDLE_VALUE)
|
||||||
warn("%s: %s", path, std::to_string(GetLastError()));
|
warn("%s: %s", path, std::to_string(GetLastError()));
|
||||||
|
|
||||||
|
|
|
@ -263,8 +263,13 @@ struct BrotliCompressionSink : ChunkedCompressionSink
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
if (!BrotliEncoderCompressStream(
|
if (!BrotliEncoderCompressStream(
|
||||||
state, data.data() ? BROTLI_OPERATION_PROCESS : BROTLI_OPERATION_FINISH, &avail_in, &next_in,
|
state,
|
||||||
&avail_out, &next_out, nullptr))
|
data.data() ? BROTLI_OPERATION_PROCESS : BROTLI_OPERATION_FINISH,
|
||||||
|
&avail_in,
|
||||||
|
&next_in,
|
||||||
|
&avail_out,
|
||||||
|
&next_out,
|
||||||
|
nullptr))
|
||||||
throw CompressionError("error while compressing brotli compression");
|
throw CompressionError("error while compressing brotli compression");
|
||||||
|
|
||||||
if (avail_out < sizeof(outbuf) || avail_in == 0) {
|
if (avail_out < sizeof(outbuf) || avail_in == 0) {
|
||||||
|
@ -280,8 +285,8 @@ struct BrotliCompressionSink : ChunkedCompressionSink
|
||||||
|
|
||||||
ref<CompressionSink> makeCompressionSink(const std::string & method, Sink & nextSink, const bool parallel, int level)
|
ref<CompressionSink> makeCompressionSink(const std::string & method, Sink & nextSink, const bool parallel, int level)
|
||||||
{
|
{
|
||||||
std::vector<std::string> la_supports = {"bzip2", "compress", "grzip", "gzip", "lrzip", "lz4",
|
std::vector<std::string> la_supports = {
|
||||||
"lzip", "lzma", "lzop", "xz", "zstd"};
|
"bzip2", "compress", "grzip", "gzip", "lrzip", "lz4", "lzip", "lzma", "lzop", "xz", "zstd"};
|
||||||
if (std::find(la_supports.begin(), la_supports.end(), method) != la_supports.end()) {
|
if (std::find(la_supports.begin(), la_supports.end(), method) != la_supports.end()) {
|
||||||
return make_ref<ArchiveCompressionSink>(nextSink, method, parallel, level);
|
return make_ref<ArchiveCompressionSink>(nextSink, method, parallel, level);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,13 @@ namespace nix {
|
||||||
Descriptor openDirectory(const std::filesystem::path & path)
|
Descriptor openDirectory(const std::filesystem::path & path)
|
||||||
{
|
{
|
||||||
return CreateFileW(
|
return CreateFileW(
|
||||||
path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING,
|
path.c_str(),
|
||||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
GENERIC_READ,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_FLAG_BACKUP_SEMANTICS,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,10 +256,13 @@ TEST_F(nix_api_expr_test, nix_value_init)
|
||||||
|
|
||||||
Value * f = nix_alloc_value(ctx, state);
|
Value * f = nix_alloc_value(ctx, state);
|
||||||
nix_expr_eval_from_string(
|
nix_expr_eval_from_string(
|
||||||
ctx, state, R"(
|
ctx,
|
||||||
|
state,
|
||||||
|
R"(
|
||||||
a: a * a
|
a: a * a
|
||||||
)",
|
)",
|
||||||
"<test>", f);
|
"<test>",
|
||||||
|
f);
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
|
@ -325,20 +328,26 @@ TEST_F(nix_api_expr_test, nix_value_init_apply_lazy_arg)
|
||||||
|
|
||||||
Value * f = nix_alloc_value(ctx, state);
|
Value * f = nix_alloc_value(ctx, state);
|
||||||
nix_expr_eval_from_string(
|
nix_expr_eval_from_string(
|
||||||
ctx, state, R"(
|
ctx,
|
||||||
|
state,
|
||||||
|
R"(
|
||||||
a: { foo = a; }
|
a: { foo = a; }
|
||||||
)",
|
)",
|
||||||
"<test>", f);
|
"<test>",
|
||||||
|
f);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
|
|
||||||
Value * e = nix_alloc_value(ctx, state);
|
Value * e = nix_alloc_value(ctx, state);
|
||||||
{
|
{
|
||||||
Value * g = nix_alloc_value(ctx, state);
|
Value * g = nix_alloc_value(ctx, state);
|
||||||
nix_expr_eval_from_string(
|
nix_expr_eval_from_string(
|
||||||
ctx, state, R"(
|
ctx,
|
||||||
|
state,
|
||||||
|
R"(
|
||||||
_ignore: throw "error message for test case nix_value_init_apply_lazy_arg"
|
_ignore: throw "error message for test case nix_value_init_apply_lazy_arg"
|
||||||
)",
|
)",
|
||||||
"<test>", g);
|
"<test>",
|
||||||
|
g);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
|
|
||||||
nix_init_apply(ctx, e, g, g);
|
nix_init_apply(ctx, e, g, g);
|
||||||
|
|
Loading…
Reference in a new issue