1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

AK: Make string-to-number conversion helpers return Optional

Get rid of the weird old signature:

- int StringType::to_int(bool& ok) const

And replace it with sensible new signature:

- Optional<int> StringType::to_int() const
This commit is contained in:
Andreas Kling 2020-06-12 21:07:52 +02:00
parent 15f4043a7a
commit fdfda6dec2
55 changed files with 354 additions and 455 deletions

View file

@ -227,9 +227,7 @@ int main(int argc, char** argv)
consume_specific('=');
consume_whitespace();
auto magic_string = extract_while([](char ch) { return !isspace(ch) && ch != '{'; });
bool ok;
endpoints.last().magic = magic_string.to_int(ok);
ASSERT(ok);
endpoints.last().magic = magic_string.to_int().value();
consume_whitespace();
consume_specific('{');
parse_messages();