mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-07-09 17:25:18 -06:00
Use more fmt::split_sv
This commit is contained in:
parent
a4649475b6
commit
fbe9ad0f45
@ -29,7 +29,7 @@ void fmt_class_string<cheat_type>::format(std::string& out, u64 arg)
|
||||
|
||||
bool cheat_info::from_str(std::string_view cheat_line)
|
||||
{
|
||||
const auto cheat_vec = fmt::split(cheat_line, {"@@@"}, false);
|
||||
auto cheat_vec = fmt::split(cheat_line, {"@@@"}, false);
|
||||
|
||||
s64 val64 = 0;
|
||||
if (cheat_vec.size() != 5 || !try_to_int64(&val64, cheat_vec[2], 0, cheat_type_max - 1))
|
||||
@ -38,11 +38,11 @@ bool cheat_info::from_str(std::string_view cheat_line)
|
||||
return false;
|
||||
}
|
||||
|
||||
game = cheat_vec[0];
|
||||
description = cheat_vec[1];
|
||||
game = std::move(cheat_vec[0]);
|
||||
description = std::move(cheat_vec[1]);
|
||||
type = cheat_type{::narrow<u8>(val64)};
|
||||
offset = std::stoul(cheat_vec[3]);
|
||||
red_script = cheat_vec[4];
|
||||
red_script = std::move(cheat_vec[4]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ void cfg_camera::camera_setting::from_string(std::string_view text)
|
||||
return;
|
||||
}
|
||||
|
||||
const std::vector<std::string> list = fmt::split(text, { "," });
|
||||
const std::vector<std::string_view> list = fmt::split_sv(text, { "," });
|
||||
|
||||
if (list.size() != member_count)
|
||||
{
|
||||
|
||||
@ -208,22 +208,23 @@ namespace utils
|
||||
content << proc_stat.rdbuf();
|
||||
proc_stat.close();
|
||||
|
||||
const std::vector<std::string> lines = fmt::split(content.str(), {"\n"});
|
||||
const std::string content_str = content.str();
|
||||
const std::vector<std::string_view> lines = fmt::split_sv(content_str, {"\n"});
|
||||
if (lines.empty())
|
||||
{
|
||||
perf_log.error("/proc/stat is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const std::string& line : lines)
|
||||
for (const std::string_view& line : lines)
|
||||
{
|
||||
const std::vector<std::string> tokens = fmt::split(line, {" "});
|
||||
const std::vector<std::string_view> tokens = fmt::split_sv(line, {" "});
|
||||
if (tokens.size() < 5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& token = tokens[0];
|
||||
const std::string_view token = tokens[0];
|
||||
if (!token.starts_with("cpu"))
|
||||
{
|
||||
return;
|
||||
|
||||
@ -765,7 +765,8 @@ utils::OS_version utils::get_OS_version()
|
||||
#else
|
||||
if (struct utsname details = {}; !uname(&details))
|
||||
{
|
||||
const std::vector<std::string> version_list = fmt::split(details.release, { "." });
|
||||
const std::string_view release = details.release;
|
||||
const std::vector<std::string_view> version_list = fmt::split_sv(release, { "." });
|
||||
const auto get_version_part = [&version_list](usz i) -> usz
|
||||
{
|
||||
if (version_list.size() <= i) return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user