diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-07-01 22:29:28 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-02 10:51:20 +0430 |
commit | 179d8f6815c0246a2834fa6e61dec0b1b7e5b6ed (patch) | |
tree | f919041d40f4d0a32864793a549d00b1e56daf56 /Userland/Libraries/LibELF/DynamicLinker.cpp | |
parent | 1498dcd9e1c98b73e65dcdbbda8518286386eb31 (diff) | |
download | serenity-179d8f6815c0246a2834fa6e61dec0b1b7e5b6ed.zip |
LibELF: Use StringView literal to avoid string allocations
Diffstat (limited to 'Userland/Libraries/LibELF/DynamicLinker.cpp')
-rw-r--r-- | Userland/Libraries/LibELF/DynamicLinker.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 3c7482aba3..9ec4c495dd 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -99,7 +99,7 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(const St static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(const String& name) { - if (name.contains("/")) { + if (name.contains("/"sv)) { int fd = open(name.characters(), O_RDONLY); if (fd < 0) return DlErrorMessage { String::formatted("Could not open shared library: {}", name) }; @@ -300,13 +300,13 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(co VERIFY(!result.is_error()); auto& object = result.value(); - if (loader.filename() == "libsystem.so") { + if (loader.filename() == "libsystem.so"sv) { if (syscall(SC_msyscall, object->base_address().as_ptr())) { VERIFY_NOT_REACHED(); } } - if (loader.filename() == "libc.so") { + if (loader.filename() == "libc.so"sv) { initialize_libc(*object); } } @@ -480,7 +480,7 @@ static Result<void, DlErrorMessage> __dladdr(void* addr, Dl_info* info) static void read_environment_variables() { for (char** env = s_envp; *env; ++env) { - if (StringView { *env } == "_LOADER_BREAKPOINT=1") { + if (StringView { *env } == "_LOADER_BREAKPOINT=1"sv) { s_do_breakpoint_trap_before_entry = true; } } |