mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +00:00
AK: Reduce the scope of fraction_string to where it's needed
pvs-studio flagged this a potential optimization, as we only need to really construct the fraction_string if is_double is true.
This commit is contained in:
parent
c192c303d2
commit
14eb736e22
Notes:
sideshowbarker
2024-07-18 03:52:31 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/14eb736e22c Pull-request: https://github.com/SerenityOS/serenity/pull/10053
1 changed files with 1 additions and 1 deletions
|
@ -234,7 +234,6 @@ Optional<JsonValue> JsonParser::parse_number()
|
|||
}
|
||||
|
||||
StringView number_string(number_buffer.data(), number_buffer.size());
|
||||
StringView fraction_string(fraction_buffer.data(), fraction_buffer.size());
|
||||
|
||||
#ifndef KERNEL
|
||||
if (is_double) {
|
||||
|
@ -250,6 +249,7 @@ Optional<JsonValue> JsonParser::parse_number()
|
|||
whole = number.value();
|
||||
}
|
||||
|
||||
StringView fraction_string(fraction_buffer.data(), fraction_buffer.size());
|
||||
auto fraction_string_uint = fraction_string.to_uint();
|
||||
if (!fraction_string_uint.has_value())
|
||||
return {};
|
||||
|
|
Loading…
Reference in a new issue