Przeglądaj źródła

LibDebug: Convert String::format() => String::formatted()

Andreas Kling 4 lat temu
rodzic
commit
83d3003208

+ 2 - 2
Userland/Libraries/LibDebug/DebugInfo.cpp

@@ -156,12 +156,12 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source
 {
 {
     String file_path = file;
     String file_path = file;
     if (!file_path.starts_with("/"))
     if (!file_path.starts_with("/"))
-        file_path = String::format("/%s", file_path.characters());
+        file_path = String::formatted("/{}", file_path);
 
 
     constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity";
     constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity";
     if (file.starts_with(SERENITY_LIBS_PREFIX)) {
     if (file.starts_with(SERENITY_LIBS_PREFIX)) {
         file_path = file.substring(sizeof(SERENITY_LIBS_PREFIX), file.length() - sizeof(SERENITY_LIBS_PREFIX));
         file_path = file.substring(sizeof(SERENITY_LIBS_PREFIX), file.length() - sizeof(SERENITY_LIBS_PREFIX));
-        file_path = String::format("../%s", file_path.characters());
+        file_path = String::formatted("../{}", file_path);
     }
     }
 
 
     Optional<SourcePositionAndAddress> result;
     Optional<SourcePositionAndAddress> result;

+ 2 - 2
Userland/Libraries/LibDebug/DebugSession.cpp

@@ -411,7 +411,7 @@ Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::ins
 
 
 void DebugSession::update_loaded_libs()
 void DebugSession::update_loaded_libs()
 {
 {
-    auto file = Core::File::construct(String::format("/proc/%u/vm", m_debuggee_pid));
+    auto file = Core::File::construct(String::formatted("/proc/{}/vm", m_debuggee_pid));
     bool rc = file->open(Core::IODevice::ReadOnly);
     bool rc = file->open(Core::IODevice::ReadOnly);
     VERIFY(rc);
     VERIFY(rc);
 
 
@@ -432,7 +432,7 @@ void DebugSession::update_loaded_libs()
         auto lib_name = result.capture_group_matches.at(0).at(0).view.u8view().to_string();
         auto lib_name = result.capture_group_matches.at(0).at(0).view.u8view().to_string();
         if (lib_name.starts_with("/"))
         if (lib_name.starts_with("/"))
             return lib_name;
             return lib_name;
-        return String::format("/usr/lib/%s", lib_name.characters());
+        return String::formatted("/usr/lib/{}", lib_name);
     };
     };
 
 
     vm_entries.for_each([&](auto& entry) {
     vm_entries.for_each([&](auto& entry) {