mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27: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
|
@ -819,8 +819,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Vector<StringView> child_argv;
|
||||
|
||||
StringView output_filename;
|
||||
char const* exclude_syscalls_option = nullptr;
|
||||
char const* include_syscalls_option = nullptr;
|
||||
StringView exclude_syscalls_option;
|
||||
StringView include_syscalls_option;
|
||||
HashTable<StringView> exclude_syscalls;
|
||||
HashTable<StringView> include_syscalls;
|
||||
|
||||
|
@ -840,9 +840,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
? TRY(Core::File::standard_error())
|
||||
: TRY(Core::File::open(output_filename, Core::File::OpenMode::Write));
|
||||
|
||||
auto parse_syscalls = [](char const* option, auto& hash_table) {
|
||||
if (option != nullptr) {
|
||||
for (auto syscall : StringView { option, strlen(option) }.split_view(','))
|
||||
auto parse_syscalls = [](StringView option, auto& hash_table) {
|
||||
if (!option.is_empty()) {
|
||||
for (auto syscall : option.split_view(','))
|
||||
hash_table.set(syscall);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue