1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:27:44 +00:00

Userland: Remove erroneous String -> char* -> StringView conversions

These were accidental (or leftover) uses of String::characters() to
construct StringViews through its StringView(char const*) constructor.
Since this constructor is due to be removed, this will no longer work.
Plus this prevents strlen from being run on these strings unnecessarily.
This commit is contained in:
sin-ack 2022-07-11 20:44:47 +00:00 committed by Andreas Kling
parent 60f6bc902b
commit a3eeeaa6a1
3 changed files with 3 additions and 3 deletions

View file

@ -113,7 +113,7 @@ void Emulator::setup_stack(Vector<ELF::AuxiliaryValue> aux_vector)
Vector<u32> env_entries; Vector<u32> env_entries;
for (auto const& variable : m_environment) { for (auto const& variable : m_environment) {
m_cpu->push_string(variable.characters()); m_cpu->push_string(variable.view());
env_entries.append(m_cpu->esp().value()); env_entries.append(m_cpu->esp().value());
} }

View file

@ -45,7 +45,7 @@ struct ArgvList {
ErrorOr<pid_t> spawn() ErrorOr<pid_t> spawn()
{ {
auto pid = TRY(System::posix_spawn(m_path.characters(), nullptr, nullptr, const_cast<char**>(get().data()), environ)); auto pid = TRY(System::posix_spawn(m_path.view(), nullptr, nullptr, const_cast<char**>(get().data()), environ));
#ifdef __serenity__ #ifdef __serenity__
TRY(System::disown(pid)); TRY(System::disown(pid));
#endif #endif

View file

@ -120,7 +120,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
ErrorOr<off_t> print_space_usage(String const& path, DuOption const& du_option, int max_depth, bool inside_dir) ErrorOr<off_t> print_space_usage(String const& path, DuOption const& du_option, int max_depth, bool inside_dir)
{ {
struct stat path_stat = TRY(Core::System::lstat(path.characters())); struct stat path_stat = TRY(Core::System::lstat(path));
off_t directory_size = 0; off_t directory_size = 0;
bool const is_directory = S_ISDIR(path_stat.st_mode); bool const is_directory = S_ISDIR(path_stat.st_mode);
if (--max_depth >= 0 && is_directory) { if (--max_depth >= 0 && is_directory) {