Minor code cleanups.

This commit is contained in:
Alexander Shaduri
2024-10-31 15:56:23 +04:00
parent af2a5a18b3
commit 02206a8967
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -21,6 +21,7 @@ Copyright:
#include <optional>
#include <unordered_map>
#include <string>
#include <vector>
#include "smartctl_parser_types.h"
#include "smartctl_parser.h"
@@ -362,7 +363,7 @@ hz::ExpectedVoid<SelfTestExecutionError> SelfTest::update(const std::shared_ptr<
std::vector<std::string> command_options = {"--capabilities", "--log=selftest"};
if (parser_format == SmartctlOutputFormat::Json) {
// --json flags: o means include original output (just in case).
command_options.push_back(" --json=o");
command_options.emplace_back(" --json=o");
}
std::string output;
@@ -505,7 +506,7 @@ hz::ExpectedVoid<SelfTestExecutionError> SelfTest::update(const std::shared_ptr<
const double gran = (double(total.count()) / 9.);
// Add 1/10 for disk load delays, etc. Limit to 15sec, in case of very quick tests.
poll_in_seconds_ = std::chrono::seconds(std::max(int64_t(15), int64_t(gran / 3. + (gran / 10.))));
poll_in_seconds_ = std::chrono::seconds(std::max(int64_t(15), int64_t((gran / 3.) + (gran / 10.))));
// for long tests we don't want to make the user wait too much, so
// we need to poll more frequently by the end, in case it's completed.
+1 -1
View File
@@ -968,7 +968,7 @@ std::vector<std::string> StorageDevice::get_device_options() const
// lowest priority - the detected type
std::vector<std::string> args;
if (!get_type_argument().empty()) {
args.push_back("-d");
args.emplace_back("-d");
args.push_back(get_type_argument());
}
// extra args, as specified manually in CLI or when adding the drive