🔨 some refactoring
This commit is contained in:
parent
22929fe189
commit
943d641054
3 changed files with 74 additions and 94 deletions
|
@ -468,7 +468,7 @@ class parser
|
|||
{
|
||||
case token_type::begin_object:
|
||||
{
|
||||
if (not sax->start_object())
|
||||
if (JSON_UNLIKELY(not sax->start_object()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ class parser
|
|||
// closing } -> we are done
|
||||
if (last_token == token_type::end_object)
|
||||
{
|
||||
if (not sax->end_object())
|
||||
if (JSON_UNLIKELY(not sax->end_object()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ class parser
|
|||
}
|
||||
else
|
||||
{
|
||||
if (not sax->key(m_lexer.move_string()))
|
||||
if (JSON_UNLIKELY(not sax->key(m_lexer.move_string())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ class parser
|
|||
|
||||
case token_type::begin_array:
|
||||
{
|
||||
if (not sax->start_array())
|
||||
if (JSON_UNLIKELY(not sax->start_array()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ class parser
|
|||
// closing ] -> we are done
|
||||
if (last_token == token_type::end_array)
|
||||
{
|
||||
if (not sax->end_array())
|
||||
if (JSON_UNLIKELY(not sax->end_array()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ class parser
|
|||
}
|
||||
else
|
||||
{
|
||||
if (not sax->number_float(res, m_lexer.move_string()))
|
||||
if (JSON_UNLIKELY(not sax->number_float(res, m_lexer.move_string())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ class parser
|
|||
|
||||
case token_type::literal_false:
|
||||
{
|
||||
if (not sax->boolean(false))
|
||||
if (JSON_UNLIKELY(not sax->boolean(false)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ class parser
|
|||
|
||||
case token_type::literal_null:
|
||||
{
|
||||
if (not sax->null())
|
||||
if (JSON_UNLIKELY(not sax->null()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ class parser
|
|||
|
||||
case token_type::literal_true:
|
||||
{
|
||||
if (not sax->boolean(true))
|
||||
if (JSON_UNLIKELY(not sax->boolean(true)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ class parser
|
|||
|
||||
case token_type::value_integer:
|
||||
{
|
||||
if (not sax->number_integer(m_lexer.get_number_integer()))
|
||||
if (JSON_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ class parser
|
|||
|
||||
case token_type::value_string:
|
||||
{
|
||||
if (not sax->string(m_lexer.move_string()))
|
||||
if (JSON_UNLIKELY(not sax->string(m_lexer.move_string())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ class parser
|
|||
|
||||
case token_type::value_unsigned:
|
||||
{
|
||||
if (not sax->number_unsigned(m_lexer.get_number_unsigned()))
|
||||
if (JSON_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ class parser
|
|||
// closing ]
|
||||
if (JSON_LIKELY(last_token == token_type::end_array))
|
||||
{
|
||||
if (not sax->end_array())
|
||||
if (JSON_UNLIKELY(not sax->end_array()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ class parser
|
|||
}
|
||||
else
|
||||
{
|
||||
if (not sax->key(m_lexer.move_string()))
|
||||
if (JSON_UNLIKELY(not sax->key(m_lexer.move_string())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ class parser
|
|||
// closing }
|
||||
if (JSON_LIKELY(last_token == token_type::end_object))
|
||||
{
|
||||
if (not sax->end_object())
|
||||
if (JSON_UNLIKELY(not sax->end_object()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue