mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibCore+Utilities: Replace uses of strpbrk with find_any_of()
We don't need to use scary C string POSIX APIs when we have nicer ones on String/DeprecatedString.
This commit is contained in:
parent
19ca8d7fb7
commit
72a48ee1ee
Notes:
sideshowbarker
2024-07-17 01:04:03 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/72a48ee1ee Pull-request: https://github.com/SerenityOS/serenity/pull/17626
2 changed files with 2 additions and 2 deletions
|
@ -74,7 +74,7 @@ ErrorOr<void> Group::add_group(Group& group)
|
|||
return Error::from_string_literal("Group name can not be empty.");
|
||||
|
||||
// A quick sanity check on group name
|
||||
if (strpbrk(group.name().characters(), "\\/!@#$%^&*()~+=`:\n"))
|
||||
if (group.name().find_any_of("\\/!@#$%^&*()~+=`:\n"sv, DeprecatedString::SearchDirection::Forward).has_value())
|
||||
return Error::from_string_literal("Group name has invalid characters.");
|
||||
|
||||
// Disallow names starting with '_', '-' or other non-alpha characters.
|
||||
|
|
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
// Let's run a quick sanity check on username
|
||||
if (strpbrk(username.characters(), "\\/!@#$%^&*()~+=`:\n")) {
|
||||
if (username.find_any_of("\\/!@#$%^&*()~+=`:\n"sv, DeprecatedString::SearchDirection::Forward).has_value()) {
|
||||
warnln("invalid character in username, {}", username);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue