mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -411,7 +411,7 @@ parse_lquery(const char *buf, struct Node *escontext)
|
||||
case LQPRS_WAITFNUM:
|
||||
if (t_iseq(ptr, ','))
|
||||
state = LQPRS_WAITSNUM;
|
||||
else if (t_isdigit(ptr))
|
||||
else if (isdigit((unsigned char) *ptr))
|
||||
{
|
||||
int low = atoi(ptr);
|
||||
|
||||
@ -429,7 +429,7 @@ parse_lquery(const char *buf, struct Node *escontext)
|
||||
UNCHAR;
|
||||
break;
|
||||
case LQPRS_WAITSNUM:
|
||||
if (t_isdigit(ptr))
|
||||
if (isdigit((unsigned char) *ptr))
|
||||
{
|
||||
int high = atoi(ptr);
|
||||
|
||||
@ -460,7 +460,7 @@ parse_lquery(const char *buf, struct Node *escontext)
|
||||
case LQPRS_WAITCLOSE:
|
||||
if (t_iseq(ptr, '}'))
|
||||
state = LQPRS_WAITEND;
|
||||
else if (!t_isdigit(ptr))
|
||||
else if (!isdigit((unsigned char) *ptr))
|
||||
UNCHAR;
|
||||
break;
|
||||
case LQPRS_WAITND:
|
||||
@ -471,7 +471,7 @@ parse_lquery(const char *buf, struct Node *escontext)
|
||||
}
|
||||
else if (t_iseq(ptr, ','))
|
||||
state = LQPRS_WAITSNUM;
|
||||
else if (!t_isdigit(ptr))
|
||||
else if (!isdigit((unsigned char) *ptr))
|
||||
UNCHAR;
|
||||
break;
|
||||
case LQPRS_WAITEND:
|
||||
|
Reference in New Issue
Block a user