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 /src/backend/port/inet_aton.c | |
| 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 'src/backend/port/inet_aton.c')
| -rw-r--r-- | src/backend/port/inet_aton.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/port/inet_aton.c b/src/backend/port/inet_aton.c index 485772619c9..b6cd4974393 100644 --- a/src/backend/port/inet_aton.c +++ b/src/backend/port/inet_aton.c @@ -1,4 +1,4 @@ -/* $Id: inet_aton.c,v 1.17 1999/07/17 04:12:09 momjian Exp $ +/* $Id: inet_aton.c,v 1.18 2000/12/03 20:45:34 tgl Exp $ * * This inet_aton() function was taken from the GNU C library and * incorporated into Postgres for those systems which do not have this @@ -83,16 +83,16 @@ inet_aton(const char *cp, struct in_addr * addr) } while ((c = *cp) != '\0') { - if (isascii(c) && isdigit(c)) + if (isdigit((unsigned char) c)) { val = (val * base) + (c - '0'); cp++; continue; } - if (base == 16 && isascii(c) && isxdigit(c)) + if (base == 16 && isxdigit((unsigned char) c)) { val = (val << 4) + - (c + 10 - (islower(c) ? 'a' : 'A')); + (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); cp++; continue; } @@ -114,10 +114,11 @@ inet_aton(const char *cp, struct in_addr * addr) } /* - * Check for trailing characters. + * Check for trailing junk. */ - if (*cp && (!isascii(*cp) || !isspace(*cp))) - return 0; + while (*cp) + if (!isspace((unsigned char) *cp++)) + return 0; /* * Concoct the address according to the number of parts specified. |
