diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-09-15 23:22:56 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-16 17:17:13 +0200 |
commit | 14eb736e22c6558941078716c528e5c037545d6e (patch) | |
tree | 27e32b5c2eaef6d4fb6ee51293914574b644b42a /AK | |
parent | c192c303d22a0b4ad698f5ad032527e3f86fbbbf (diff) | |
download | serenity-14eb736e22c6558941078716c528e5c037545d6e.zip |
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.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/JsonParser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/JsonParser.cpp b/AK/JsonParser.cpp index 4d497cb1b5..fafb6736a6 100644 --- a/AK/JsonParser.cpp +++ b/AK/JsonParser.cpp @@ -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 {}; |