diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-04 11:47:21 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-04 11:47:21 +0200 |
commit | b62a12c687bf1f6d6e0dde129ef783139592e6c0 (patch) | |
tree | ee382853ce303fdc022fd16c08e07199505911e5 /AK/JsonParser.h | |
parent | 93596dc00db7eef6763765fdc45686cfe0f53929 (diff) | |
download | serenity-b62a12c687bf1f6d6e0dde129ef783139592e6c0.zip |
JsonParser: Some minor optimizations
- Return more specific types from parse_array() and parse_object().
- Don't create a throwaway String in extract_while().
- Use a StringView in parse_number() to avoid a throwaway String.
Diffstat (limited to 'AK/JsonParser.h')
-rw-r--r-- | AK/JsonParser.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/AK/JsonParser.h b/AK/JsonParser.h index 76f7d7e5bf..343530d7f4 100644 --- a/AK/JsonParser.h +++ b/AK/JsonParser.h @@ -23,8 +23,8 @@ private: void consume_specific(char expected_ch); void consume_string(const char*); String consume_quoted_string(); - JsonValue parse_array(); - JsonValue parse_object(); + JsonArray parse_array(); + JsonObject parse_object(); JsonValue parse_number(); JsonValue parse_string(); JsonValue parse_false(); @@ -36,7 +36,7 @@ private: void consume_while(C); template<typename C> - String extract_while(C); + Vector<char, 128> extract_while(C); StringView m_input; int m_index { 0 }; |