pgsql: Improve code clarity in epilogue of UTF-8 verification fast path

From: John Naylor <john(dot)naylor(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve code clarity in epilogue of UTF-8 verification fast path
Date: 2022-01-18 04:03:41
Message-ID: E1n9fif-00084L-4F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve code clarity in epilogue of UTF-8 verification fast path

The previous coding was correct, but the style and commentary were a bit
vague about which operations had to happen, in what circumstances, and
in what order. Rearrange so that the epilogue does nothing in the DFA END
state. That allows turning some conditional statements in the backtracking
logic into asserts. With that, we can be more explicit about needing
to backtrack at least one byte in non-END states to ensure checking the
current byte sequence in the slow path. No change to the regression tests,
since they should be able catch deficiencies here already.

In passing, improve the comments around DFA states where the first
continuation byte has a restricted range.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d3f45323bbe734bff1f778bb819ce95b718d73ed

Modified Files
--------------
src/common/wchar.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2022-01-18 05:45:01 pgsql: Replace use of deprecated Python module distutils.sysconfig
Previous Message Tom Lane 2022-01-18 02:19:23 pgsql: Fix psql \d's query for identifying parent triggers.