Re: [HACKERS] Re: your mail - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: your mail
Date
Msg-id 199905100043.UAA04227@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: your mail  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
I think we decided against this, right?

> >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;
>   }
>   
>   /*
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Sequences....
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of frying pan, into fire)