Re: [PATCH v5 02/12] ctype: support iscntrl, ispunct, isxdigit and isprint
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Oct 17, 2012, 12:26 UTC
- Message-ID
- <CACsJy8D3WteqsQN_1UxYyE8ADZom6T4Udo8W=hCqiAn+W4K8vQ@mail.gmail.com>
- In-Reply-To
- <507E9FDE.7080706@cs.tu-berlin.de>
On Wed, Oct 17, 2012 at 7:09 PM, "Jan H. Schönherr" <schnhrr@cs.tu-berlin.de> wrote:
Show 8 quoted lines
>> const unsigned char sane_ctype[256] = {
>> - 0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
>> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
>> + X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */
>> + X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */
>
> "Normal" isspace() also includes vertical tab (11) and form-feed (12) as
> white-space characters. Is there a reason, why they are not included here?I'm not sure. They were not classified as spaces in the very first version in 4546738 (Unlocalized isspace and friends - 2005-10-13). Maybe Linus had a reason to do so.
Show 8 quoted lines
>> +#define isprint(x) (sane_istest(x, GIT_ALPHA | GIT_DIGIT | GIT_SPACE | \ >> + GIT_PUNCT | GIT_REGEX_SPECIAL | GIT_GLOB_SPECIAL | \ >> + GIT_PATHSPEC_MAGIC)) > > "Normal" isprint() only includes space (32) from the white-space characters. > The other white-space characters are not considered printable. > > Do we want to stay close to the "original", or not?
We do. I followed [1] but obvious missed the last sentence in "print" description: "No characters specified for the keyword cntrl shall be specified". Thanks for catching. I'll fix it soon.
[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
-- Duy