diff options
| author | Tom Lane | 2000-12-03 20:45:40 +0000 |
|---|---|---|
| committer | Tom Lane | 2000-12-03 20:45:40 +0000 |
| commit | a27b691e2903a886be640db801677f6f988d3793 (patch) | |
| tree | c68f25c9edef18954e9c5b3d74893f1df87b8871 /contrib/fulltextindex | |
| parent | 4d2a506526ceacab5f75df040596a5287ab40612 (diff) | |
Ensure that all uses of <ctype.h> 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.
Diffstat (limited to 'contrib/fulltextindex')
| -rw-r--r-- | contrib/fulltextindex/fti.c | 15 |
1 files changed, 7 insertions, 8 deletions
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 <ctype.h> /* tolower */ +#include <ctype.h> #include <stdio.h> /* 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); |
