Move is_valid_ascii() to ascii.h.
authorNathan Bossart <nathan@postgresql.org>
Mon, 29 Jan 2024 18:08:57 +0000 (12:08 -0600)
committerNathan Bossart <nathan@postgresql.org>
Mon, 29 Jan 2024 18:08:57 +0000 (12:08 -0600)
commit97287bdfae41b8ea16b27dccb63771fcc196a55a
treefe38b931de8086874499b590a525883ad55fe0d0
parent400928b83bd254d20f0790d467f221bb52707e6e
Move is_valid_ascii() to ascii.h.

This function requires simd.h, which is a rather large dependency
for a widely-used header file like pg_wchar.h.  Furthermore, there
is a report of a third-party tool that is struggling to use
pg_wchar.h due to its dependence on simd.h (presumably because
simd.h uses several intrinsics).  Moving the function to the much
less popular ascii.h resolves these issues for now.

This commit is back-patched for the benefit of the aforementioned
third-party tool.  The simd.h dependency was only added in v16,
but we've opted to back-patch to v15 so that is_valid_ascii() lives
in the same file for all versions where it exists.  This could
break existing third-party code that uses the function, but we
couldn't find any examples of such code.  It should be possible to
fix any code that this commit breaks by including ascii.h in the
file that uses is_valid_ascii().

Author: Jubilee Young
Reviewed-by: Tom Lane, John Naylor, Andres Freund, Eric Ridge
Discussion: https://postgr.es/m/CAPNHn3oKJJxMsYq%2BqLYzVJOFrUcOr4OF1EC-KtFT-qh8nOOOtQ%40mail.gmail.com
Backpatch-through: 15
src/common/wchar.c
src/include/mb/pg_wchar.h
src/include/utils/ascii.h