Re: [HACKERS] Re: your mail
| От | Tatsuo Ishii |
|---|---|
| Тема | Re: [HACKERS] Re: your mail |
| Дата | |
| Msg-id | 199903160216.LAA08921@srapc451.sra.co.jp обсуждение исходный текст |
| Ответ на | Re: your mail (Bruce Momjian <maillist@candle.pha.pa.us>) |
| Ответы |
Re: [HACKERS] Re: your mail
|
| Список | 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(structparse * 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(structparse * 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; } /*
В списке pgsql-hackers по дате отправления: