pgsql: Remove ts_locale.c's t_isdigit(), t_isspace(), t_isprint() - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: Remove ts_locale.c's t_isdigit(), t_isspace(), t_isprint()
Date
Msg-id E1tNWCJ-0001oo-J1@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove ts_locale.c's t_isdigit(), t_isspace(), t_isprint()

These do the same thing as the standard isdigit(), isspace(), and
isprint() but with multibyte and encoding support.  But all the
callers are only interested in analyzing single-byte ASCII characters.
So this extra layer is overkill and we can replace the uses with the
standard functions.

All the t_is*() functions in ts_locale.c are under scrutiny because
they don't use the common locale provider framework but instead use
the global libc locale settings.  For the functions being touched by
this patch, we don't need all that anyway, as mentioned above, so the
simplest solution is to just remove them.  The few remaining t_is*()
functions will need a different treatment in a separate patch.

pg_trgm has some compile-time options with macros such as
KEEPONLYALNUM.  These are not documented, and the non-default variant
is not supported by any test cases.  As part of this undertaking, I'm
removing the non-default variant, as it is in the way of cleanup.  So
in this case, the not-KEEPONLYALNUM code path is gone.

Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://www.postgresql.org/message-id/flat/653f3b84-fc87-45a7-9a0c-bfb4fcab3e7d%40eisentraut.org

Branch
------
master

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

Modified Files
--------------
contrib/dict_xsyn/dict_xsyn.c           |  4 +--
contrib/ltree/ltree_io.c                |  8 +++---
contrib/ltree/ltxtquery_io.c            |  2 +-
contrib/pg_trgm/trgm.h                  |  6 -----
contrib/unaccent/unaccent.c             |  2 +-
src/backend/tsearch/dict_synonym.c      |  4 +--
src/backend/tsearch/dict_thesaurus.c    | 10 ++++----
src/backend/tsearch/spell.c             | 44 ++++++++++++++++----------------
src/backend/tsearch/ts_locale.c         | 45 ---------------------------------
src/backend/tsearch/ts_utils.c          |  2 +-
src/backend/utils/adt/tsquery.c         | 12 ++++-----
src/backend/utils/adt/tsvector_parser.c | 10 ++++----
src/include/tsearch/ts_locale.h         |  3 ---
13 files changed, 49 insertions(+), 103 deletions(-)


pgsql-committers by date:

Previous
From: Richard Guo
Date:
Subject: pgsql: Avoid unnecessary wrapping for more complex expressions
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Remove ts_locale.c's lowerstr()