remove string wrappers

This commit is contained in:
nmzik
2026-09-17 19:50:03 +04:00
parent cc8e02380f
commit 2bf78a94e0
10 changed files with 1099 additions and 1394 deletions
+7 -8
View File
@@ -301,9 +301,9 @@ static KYTY_SYSV_ABI uint64_t ResolveImportStubWithId(uint64_t record_id) {
if (record_id < g_stubbed_imports.size()) {
auto& record = g_stubbed_imports[record_id];
auto nid = record.name;
auto pos = Common::FindIndex(nid, "[");
if (Common::IndexValid(nid, pos)) {
nid = Common::Left(nid, pos);
auto pos = nid.find('[');
if (pos != std::string::npos) {
nid.resize(pos);
}
SymbolRecord resolved {};
@@ -1088,7 +1088,7 @@ static void RelocateRecord(uint32_t index, Elf64_Rela* r, Program* program, bool
}
if (program->dbg_print_reloc) {
if (/* !dbg_str.ContainsStr("libc_") && */ patched && !ri.bind_self &&
if (patched && !ri.bind_self &&
(ri.bind == BindType::Global || ri.bind == BindType::Weak ||
ri.type == SymbolType::TlsModule)) {
auto dbg_str = fmt::format("[{:016x}] <- {:016x}, {}, {}, {}, {}", ri.vaddr, ri.value,
@@ -1390,9 +1390,8 @@ Program* RuntimeLinker::LoadProgram(const std::filesystem::path& elf_name) {
Libs::LibKernel::SetProgName(elf_name.filename().string());
}
if (Common::EndsWith(Common::ToLower(Common::DirectoryWithoutFilename(
Common::PathToGenericString(elf_name))),
"_module/")) {
if (Common::ToLower(Common::DirectoryWithoutFilename(Common::PathToGenericString(elf_name)))
.ends_with("_module/")) {
program->fail_if_global_not_resolved = false;
}
@@ -1818,7 +1817,7 @@ void RuntimeLinker::StopAllModules() {
static bool IsAdjacentModuleFile(const std::string& name) {
auto lower = Common::ToLower(name);
return Common::EndsWith(lower, ".prx") || Common::EndsWith(lower, ".sprx");
return lower.ends_with(".prx") || lower.ends_with(".sprx");
}
static bool SkipAdjacentModuleFile(const std::string& name) {
+3 -3
View File
@@ -10,7 +10,7 @@ namespace Loader {
constexpr char LIB_PREFIX[] = "libSce";
static std::string UpdateName(const std::string& str) {
return Common::StartsWith(str, LIB_PREFIX) ? Common::RemoveFirst(str, 6) : str;
return str.starts_with(LIB_PREFIX) ? Common::RemoveFirst(str, 6) : str;
}
std::string SymbolDatabase::GenerateName(const SymbolResolve& s) {
@@ -70,7 +70,7 @@ const SymbolRecord* SymbolDatabase::FindByNid(const std::string& nid, SymbolType
auto suffix = fmt::format("[{}]", magic_enum::enum_name(type));
for (const auto& symbol: m_symbols) {
if (Common::StartsWith(symbol.name, prefix) && Common::EndsWith(symbol.name, suffix)) {
if (symbol.name.starts_with(prefix) && symbol.name.ends_with(suffix)) {
return &symbol;
}
}
@@ -83,7 +83,7 @@ const SymbolRecord* SymbolDatabase::FindByName(const std::string& name, SymbolTy
auto suffix = fmt::format("[{}]", magic_enum::enum_name(type));
for (const auto& symbol: m_symbols) {
if (Common::StartsWith(symbol.name, prefix) && Common::EndsWith(symbol.name, suffix)) {
if (symbol.name.starts_with(prefix) && symbol.name.ends_with(suffix)) {
return &symbol;
}
}