Re: [HACKERS] Re: your mail

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: angelos(at)incredible(dot)com (Angelos Karageorgiou), pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] Re: your mail
Date: 1999-03-16 02:16:28
Message-ID: 199903160216.LAA08921@srapc451.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>Did we reject this 'unsigned' patch, folks? I seem to remember someone
>objecting to it.
[snip]
>> ***************
>> *** 1862,1868 ****
>> #ifdef MULTIBYTE
>> return (c >= 0 && c <= UCHAR_MAX && isdigit(c));
>> #else
>> ! return (isdigit(c));
>> #endif
>> }
>>
>> --- 1862,1868 ----
>> #ifdef MULTIBYTE
>> return (c >= 0 && c <= UCHAR_MAX && isdigit(c));
>> #else
>> ! return (isdigit((unsigned char)c));
>> #endif
>> }

According to the ANSI/C standard the argument to isdigit (or some
other friends) must have the value of either an unsigned char or
*EOF*. That's why the argument is typed to int, I guess. This patch
seems to break the rule?

BTW, I would like to propose yet another patches for the problem. This
seems to work on FreeBSD and Linux. Angelos, can you test it on your
platform (is it a BSD/OS?)?
--
Tatsuo Ishii

*** regcomp.c~ Tue Sep 1 13:31:25 1998
--- regcomp.c Thu Mar 11 16:51:28 1999
***************
*** 95,101 ****
static void p_b_eclass(struct parse * p, cset *cs);
static pg_wchar p_b_symbol(struct parse * p);
static char p_b_coll_elem(struct parse * p, int endc);
! static char othercase(int ch);
static void bothcases(struct parse * p, int ch);
static void ordinary(struct parse * p, int ch);
static void nonnewline(struct parse * p);
--- 95,101 ----
static void p_b_eclass(struct parse * p, cset *cs);
static pg_wchar p_b_symbol(struct parse * p);
static char p_b_coll_elem(struct parse * p, int endc);
! static unsigned char othercase(int ch);
static void bothcases(struct parse * p, int ch);
static void ordinary(struct parse * p, int ch);
static void nonnewline(struct parse * p);
***************
*** 1032,1049 ****
- othercase - return the case counterpart of an alphabetic
== static char othercase(int ch);
*/
! static char /* if no counterpart, return ch */
othercase(ch)
int ch;
{
assert(pg_isalpha(ch));
if (pg_isupper(ch))
! return tolower(ch);
else if (pg_islower(ch))
! return toupper(ch);
else
/* peculiar, but could happen */
! return ch;
}

/*
--- 1032,1049 ----
- othercase - return the case counterpart of an alphabetic
== static char othercase(int ch);
*/
! static unsigned char /* if no counterpart, return ch */
othercase(ch)
int ch;
{
assert(pg_isalpha(ch));
if (pg_isupper(ch))
! return (unsigned char)tolower(ch);
else if (pg_islower(ch))
! return (unsigned char)toupper(ch);
else
/* peculiar, but could happen */
! return (unsigned char)ch;
}

/*

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-03-16 02:44:05 snprintf() instead of sprintf() ?
Previous Message Tatsuo Ishii 1999-03-16 01:52:53 non existing table error message changed?