diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-23 12:39:00 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-14 23:03:36 +0200 |
commit | 300823c314cd773cd10486b9066309415160eec5 (patch) | |
tree | 235222ed29edf11eec4288f48e68f54ca6054a8a /Userland/Libraries | |
parent | c3ad8e9a52fa0eb2ac8dcc64fbc7f08631968e41 (diff) | |
download | serenity-300823c314cd773cd10486b9066309415160eec5.zip |
LibWeb: Use move() when enqueuing tokens in HTMLTokenizer
We're not using the current token anymore once it's enqueued so let's
use move() when enqueuing the tokens.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 90d13540f4..4ca33217a0 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -57,13 +57,13 @@ namespace Web::HTML { goto _StartOfFunction; \ } while (0) -#define SWITCH_TO_AND_EMIT_CURRENT_TOKEN(new_state) \ - do { \ - will_switch_to(State::new_state); \ - m_state = State::new_state; \ - will_emit(m_current_token); \ - m_queued_tokens.enqueue(m_current_token); \ - return m_queued_tokens.dequeue(); \ +#define SWITCH_TO_AND_EMIT_CURRENT_TOKEN(new_state) \ + do { \ + will_switch_to(State::new_state); \ + m_state = State::new_state; \ + will_emit(m_current_token); \ + m_queued_tokens.enqueue(move(m_current_token)); \ + return m_queued_tokens.dequeue(); \ } while (0) #define EMIT_CHARACTER_AND_RECONSUME_IN(code_point, new_state) \ @@ -83,7 +83,7 @@ namespace Web::HTML { create_new_token(HTMLToken::Type::Character); \ m_current_builder.append_code_point(code_point); \ m_current_token.m_comment_or_character.data = consume_current_builder(); \ - m_queued_tokens.enqueue(m_current_token); \ + m_queued_tokens.enqueue(move(m_current_token)); \ } \ } \ } while (0) @@ -122,22 +122,22 @@ namespace Web::HTML { #define ANYTHING_ELSE if (1) -#define EMIT_EOF \ - do { \ - if (m_has_emitted_eof) \ - return {}; \ - m_has_emitted_eof = true; \ - create_new_token(HTMLToken::Type::EndOfFile); \ - will_emit(m_current_token); \ - m_queued_tokens.enqueue(m_current_token); \ - return m_queued_tokens.dequeue(); \ +#define EMIT_EOF \ + do { \ + if (m_has_emitted_eof) \ + return {}; \ + m_has_emitted_eof = true; \ + create_new_token(HTMLToken::Type::EndOfFile); \ + will_emit(m_current_token); \ + m_queued_tokens.enqueue(move(m_current_token)); \ + return m_queued_tokens.dequeue(); \ } while (0) -#define EMIT_CURRENT_TOKEN \ - do { \ - will_emit(m_current_token); \ - m_queued_tokens.enqueue(m_current_token); \ - return m_queued_tokens.dequeue(); \ +#define EMIT_CURRENT_TOKEN \ + do { \ + will_emit(m_current_token); \ + m_queued_tokens.enqueue(move(m_current_token)); \ + return m_queued_tokens.dequeue(); \ } while (0) #define EMIT_CHARACTER(code_point) \ @@ -145,7 +145,7 @@ namespace Web::HTML { create_new_token(HTMLToken::Type::Character); \ m_current_builder.append_code_point(code_point); \ m_current_token.m_comment_or_character.data = consume_current_builder(); \ - m_queued_tokens.enqueue(m_current_token); \ + m_queued_tokens.enqueue(move(m_current_token)); \ return m_queued_tokens.dequeue(); \ } while (0) @@ -409,7 +409,7 @@ _StartOfFunction: } ON_EOF { - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ON(0) @@ -441,7 +441,7 @@ _StartOfFunction: log_parse_error(); create_new_token(HTMLToken::Type::DOCTYPE); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -485,7 +485,7 @@ _StartOfFunction: log_parse_error(); create_new_token(HTMLToken::Type::DOCTYPE); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -525,7 +525,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -550,7 +550,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -596,7 +596,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -638,7 +638,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -676,7 +676,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -714,7 +714,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -750,7 +750,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -785,7 +785,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -820,7 +820,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -855,7 +855,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -892,7 +892,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -928,7 +928,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -954,7 +954,7 @@ _StartOfFunction: { log_parse_error(); m_current_token.m_doctype.force_quirks = true; - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -978,7 +978,7 @@ _StartOfFunction: } ON_EOF { - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -1360,7 +1360,7 @@ _StartOfFunction: ON_EOF { log_parse_error(); - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -1391,7 +1391,7 @@ _StartOfFunction: ON_EOF { log_parse_error(); - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -1421,7 +1421,7 @@ _StartOfFunction: ON_EOF { log_parse_error(); - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -1447,7 +1447,7 @@ _StartOfFunction: ON_EOF { log_parse_error(); - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE @@ -1467,7 +1467,7 @@ _StartOfFunction: ON_EOF { log_parse_error(); - m_queued_tokens.enqueue(m_current_token); + m_queued_tokens.enqueue(move(m_current_token)); EMIT_EOF; } ANYTHING_ELSE |