mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +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
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
char const* path;
|
||||
DeprecatedString path;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help(
|
||||
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(path, "Path to resolve", "path");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
char* value = realpath(path, nullptr);
|
||||
char* value = realpath(path.characters(), nullptr);
|
||||
if (value == nullptr) {
|
||||
perror("realpath");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue