mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
This commit is contained in:
parent
60908adcbe
commit
500044906d
43 changed files with 122 additions and 145 deletions
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio wpath rpath cpath chown"));
|
||||
|
||||
char const* home_path = nullptr;
|
||||
StringView home_path;
|
||||
int uid = 0;
|
||||
int gid = USERS_GID;
|
||||
bool create_home_dir = false;
|
||||
|
@ -108,7 +108,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
DeprecatedString home;
|
||||
if (!home_path)
|
||||
if (home_path.is_empty())
|
||||
home = DeprecatedString::formatted("/home/{}", username);
|
||||
else
|
||||
home = home_path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue