mirror of
https://github.com/NixOS/nix
synced 2025-07-03 22:51:47 +02:00
* Templatise getIntArg / string2Int.
This commit is contained in:
parent
8022015552
commit
9b8fda796b
5 changed files with 25 additions and 40 deletions
|
@ -532,10 +532,10 @@ static void opGC(Strings opFlags, Strings opArgs)
|
|||
else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead;
|
||||
else if (*i == "--delete") options.action = GCOptions::gcDeleteDead;
|
||||
else if (*i == "--max-freed") {
|
||||
options.maxFreed = getIntArg(*i, i, opFlags.end());
|
||||
if (options.maxFreed == 0) options.maxFreed = 1;
|
||||
long long maxFreed = getIntArg<long long>(*i, i, opFlags.end());
|
||||
options.maxFreed = maxFreed >= 1 ? maxFreed : 1;
|
||||
}
|
||||
else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end());
|
||||
else if (*i == "--max-links") options.maxLinks = getIntArg<unsigned int>(*i, i, opFlags.end());
|
||||
else throw UsageError(format("bad sub-operation `%1%' in GC") % *i);
|
||||
|
||||
if (!opArgs.empty()) throw UsageError("no arguments expected");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue