mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-04 04:56:50 +02:00
Remove redundant test.
The condition "context_start < context_end" is strictly weaker
than "context_end - context_start >= 50", so we don't need both.
Oversight in commit ffd3944ab
, noted by tanghy.fnst.
In passing, line-wrap a nearby test to make it more readable.
Discussion: https://postgr.es/m/OS0PR01MB61137C4054774F44E3A9DC89FBC69@OS0PR01MB6113.jpnprd01.prod.outlook.com
This commit is contained in:
parent
a780b2fcce
commit
373e08a9f7
@ -652,7 +652,7 @@ report_json_context(JsonLexContext *lex)
|
|||||||
context_end = lex->token_terminator;
|
context_end = lex->token_terminator;
|
||||||
|
|
||||||
/* Advance until we are close enough to context_end */
|
/* Advance until we are close enough to context_end */
|
||||||
while (context_end - context_start >= 50 && context_start < context_end)
|
while (context_end - context_start >= 50)
|
||||||
{
|
{
|
||||||
/* Advance to next multibyte character */
|
/* Advance to next multibyte character */
|
||||||
if (IS_HIGHBIT_SET(*context_start))
|
if (IS_HIGHBIT_SET(*context_start))
|
||||||
@ -680,7 +680,9 @@ report_json_context(JsonLexContext *lex)
|
|||||||
* suffixing "..." if not ending at end of line.
|
* suffixing "..." if not ending at end of line.
|
||||||
*/
|
*/
|
||||||
prefix = (context_start > line_start) ? "..." : "";
|
prefix = (context_start > line_start) ? "..." : "";
|
||||||
suffix = (lex->token_type != JSON_TOKEN_END && context_end - lex->input < lex->input_length && *context_end != '\n' && *context_end != '\r') ? "..." : "";
|
suffix = (lex->token_type != JSON_TOKEN_END &&
|
||||||
|
context_end - lex->input < lex->input_length &&
|
||||||
|
*context_end != '\n' && *context_end != '\r') ? "..." : "";
|
||||||
|
|
||||||
return errcontext("JSON data, line %d: %s%s%s",
|
return errcontext("JSON data, line %d: %s%s%s",
|
||||||
lex->line_number, prefix, ctxt, suffix);
|
lex->line_number, prefix, ctxt, suffix);
|
||||||
|
Loading…
Reference in New Issue
Block a user