From a27b691e2903a886be640db801677f6f988d3793 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 3 Dec 2000 20:45:40 +0000 Subject: Ensure that all uses of functions are applied to unsigned-char values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00. --- contrib/fulltextindex/fti.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'contrib/fulltextindex') diff --git a/contrib/fulltextindex/fti.c b/contrib/fulltextindex/fti.c index bb4636ff3e0..75358958c5b 100644 --- a/contrib/fulltextindex/fti.c +++ b/contrib/fulltextindex/fti.c @@ -1,7 +1,7 @@ #include "postgres.h" #include "executor/spi.h" #include "commands/trigger.h" -#include /* tolower */ +#include #include /* debugging */ /* @@ -256,10 +256,9 @@ fti(PG_FUNCTION_ARGS) char *string = column; while (*string != '\0') - { /* placed 'really' inline. */ - *string = tolower(*string); /* some compilers will - * choke */ - string++; /* on 'inline' keyword */ + { + *string = tolower((unsigned char) *string); + string++; } data = (struct varlena *) palloc(sizeof(int32) + strlen(column) +1); @@ -312,9 +311,9 @@ breakup(char *string, char *substring) * (ie. 'string$%^&', last_start first points to '&', and after * this to 'g' */ - if (!isalnum((int) *last_start)) + if (!isalnum((unsigned char) *last_start)) { - while (!isalnum((int) *last_start) && + while (!isalnum((unsigned char) *last_start) && last_start > string) last_start--; cur_pos = last_start; @@ -323,7 +322,7 @@ breakup(char *string, char *substring) cur_pos--; /* substrings are at minimum 2 characters * long */ - if (isalnum((int) *cur_pos)) + if (isalnum((unsigned char) *cur_pos)) { /* Houston, we have a substring! :) */ memcpy(substring, cur_pos, last_start - cur_pos + 1); -- cgit v1.2.3