mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +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
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…
Add table
Add a link
Reference in a new issue