mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:15:09 +00:00
Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as to_number will handle something such as: ``` Optional<I> opt; if constexpr (IsSigned<I>) opt = view.to_int<I>(); else opt = view.to_uint<I>(); ``` For us. The main goal here however is to have a single generic number conversion API between all of the String classes.
This commit is contained in:
parent
a4ecc65398
commit
e2e7c4d574
155 changed files with 397 additions and 412 deletions
|
@ -79,7 +79,7 @@ ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<Err
|
|||
|
||||
ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS& procfs, StringView name) const
|
||||
{
|
||||
auto maybe_needle = name.to_uint();
|
||||
auto maybe_needle = name.to_number<unsigned>();
|
||||
if (!maybe_needle.has_value())
|
||||
return ENOENT;
|
||||
auto needle = maybe_needle.release_value();
|
||||
|
@ -120,7 +120,7 @@ ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<E
|
|||
|
||||
ErrorOr<NonnullRefPtr<Inode>> Process::lookup_children_directory(ProcFS& procfs, StringView name) const
|
||||
{
|
||||
auto maybe_pid = name.to_uint();
|
||||
auto maybe_pid = name.to_number<unsigned>();
|
||||
if (!maybe_pid.has_value())
|
||||
return ENOENT;
|
||||
|
||||
|
@ -173,7 +173,7 @@ ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, F
|
|||
|
||||
ErrorOr<NonnullRefPtr<Inode>> Process::lookup_file_descriptions_directory(ProcFS& procfs, StringView name) const
|
||||
{
|
||||
auto maybe_index = name.to_uint();
|
||||
auto maybe_index = name.to_number<unsigned>();
|
||||
if (!maybe_index.has_value())
|
||||
return ENOENT;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue