diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2024-12-17 12:48:58 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2024-12-17 12:52:29 +0100 |
commit | d3aad4ac57c5592ade77916404e6d8a989a1d6a1 (patch) | |
tree | 5a131f30f7cba2380960c7dfa5c1190eea906ff4 /src/backend/utils/adt/tsquery.c | |
parent | 60be3f9f0a64a071822c0711f69c7b5f6467d84f (diff) | |
download | postgresql-d3aad4ac57c5592ade77916404e6d8a989a1d6a1.tar.gz postgresql-d3aad4ac57c5592ade77916404e6d8a989a1d6a1.zip |
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
Diffstat (limited to 'src/backend/utils/adt/tsquery.c')
-rw-r--r-- | src/backend/utils/adt/tsquery.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 6f532188392..0366c2a2acd 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -197,7 +197,7 @@ parse_phrase_operator(TSQueryParserState pstate, int16 *distance) continue; } - if (!t_isdigit(ptr)) + if (!isdigit((unsigned char) *ptr)) return false; errno = 0; @@ -274,7 +274,7 @@ parse_or_operator(TSQueryParserState pstate) * So we still treat OR literal as operation with possibly incorrect * operand and will not search it as lexeme */ - if (!t_isspace(ptr)) + if (!isspace((unsigned char) *ptr)) break; } @@ -315,7 +315,7 @@ gettoken_query_standard(TSQueryParserState state, int8 *operator, /* generic syntax error message is fine */ return PT_ERR; } - else if (!t_isspace(state->buf)) + else if (!isspace((unsigned char) *state->buf)) { /* * We rely on the tsvector parser to parse the value for @@ -383,7 +383,7 @@ gettoken_query_standard(TSQueryParserState state, int8 *operator, { return (state->count) ? PT_ERR : PT_END; } - else if (!t_isspace(state->buf)) + else if (!isspace((unsigned char) *state->buf)) { return PT_ERR; } @@ -444,7 +444,7 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, state->state = WAITOPERAND; continue; } - else if (!t_isspace(state->buf)) + else if (!isspace((unsigned char) *state->buf)) { /* * We rely on the tsvector parser to parse the value for @@ -492,7 +492,7 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, state->buf++; continue; } - else if (!t_isspace(state->buf)) + else if (!isspace((unsigned char) *state->buf)) { /* insert implicit AND between operands */ state->state = WAITOPERAND; |