mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
This commit is contained in:
parent
c70f45ff44
commit
e5f09ea170
51 changed files with 282 additions and 261 deletions
|
@ -73,14 +73,14 @@ ErrorOr<Account> Account::self([[maybe_unused]] Read options)
|
|||
|
||||
auto pwd = TRY(Core::System::getpwuid(getuid()));
|
||||
if (!pwd.has_value())
|
||||
return Error::from_string_literal("No such user"sv);
|
||||
return Error::from_string_literal("No such user");
|
||||
|
||||
spwd spwd = {};
|
||||
#ifndef AK_OS_BSD_GENERIC
|
||||
if (options != Read::PasswdOnly) {
|
||||
auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) }));
|
||||
if (!maybe_spwd.has_value())
|
||||
return Error::from_string_literal("No shadow entry for user"sv);
|
||||
return Error::from_string_literal("No shadow entry for user");
|
||||
spwd = maybe_spwd.release_value();
|
||||
}
|
||||
#endif
|
||||
|
@ -92,14 +92,14 @@ ErrorOr<Account> Account::from_name(char const* username, [[maybe_unused]] Read
|
|||
{
|
||||
auto pwd = TRY(Core::System::getpwnam({ username, strlen(username) }));
|
||||
if (!pwd.has_value())
|
||||
return Error::from_string_literal("No such user"sv);
|
||||
return Error::from_string_literal("No such user");
|
||||
|
||||
spwd spwd = {};
|
||||
#ifndef AK_OS_BSD_GENERIC
|
||||
if (options != Read::PasswdOnly) {
|
||||
auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) }));
|
||||
if (!maybe_spwd.has_value())
|
||||
return Error::from_string_literal("No shadow entry for user"sv);
|
||||
return Error::from_string_literal("No shadow entry for user");
|
||||
spwd = maybe_spwd.release_value();
|
||||
}
|
||||
#endif
|
||||
|
@ -110,14 +110,14 @@ ErrorOr<Account> Account::from_uid(uid_t uid, [[maybe_unused]] Read options)
|
|||
{
|
||||
auto pwd = TRY(Core::System::getpwuid(uid));
|
||||
if (!pwd.has_value())
|
||||
return Error::from_string_literal("No such user"sv);
|
||||
return Error::from_string_literal("No such user");
|
||||
|
||||
spwd spwd = {};
|
||||
#ifndef AK_OS_BSD_GENERIC
|
||||
if (options != Read::PasswdOnly) {
|
||||
auto maybe_spwd = TRY(Core::System::getspnam({ pwd->pw_name, strlen(pwd->pw_name) }));
|
||||
if (!maybe_spwd.has_value())
|
||||
return Error::from_string_literal("No shadow entry for user"sv);
|
||||
return Error::from_string_literal("No shadow entry for user");
|
||||
spwd = maybe_spwd.release_value();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue