Re: [PATCH v5 02/12] ctype: support iscntrl, ispunct, isxdigit and isprint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 14, 2012 at 7:59 PM, René Scharfe
<rene.scharfe@xxxxxxxxxxxxxx> wrote:
>> +const unsigned char sane_ctype2[256] = {
>> +       CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, /*
>> 0..15 */
>> +       CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, CN, /*
>> 16..31 */
>> +       0,  PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, PU, /*
>> 32..47 */
>> +       XD, XD, XD, XD, XD, XD, XD, XD, XD, XD, PU, PU, PU, PU, PU, PU, /*
>> 48..63 */
>> +       PU, 0,  XD, 0,  XD, 0,  XD, 0,  0,  0,  0,  0,  0,  0,  0,  0,  /*
>> 64..79 */
>> +       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  PU, PU, PU, PU, PU, /*
>> 80..95 */
>> +       PU, 0,  XD, 0,  XD, 0,  XD, 0,  0,  0,  0,  0,  0,  0,  0,  0,  /*
>> 96..111 */
>> +       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  PU, PU, PU, PU, CN, /*
>> 112..127 */
>
>
> Shouldn't [ace] (65, 67, 69) and [ACE] (97, 99, 101) be xdigits as well?

Hmm.. I generated it from LANG=C. I wonder where I got it wrong..

> But how about using the existing hexval_table instead, like this:
>
>         #define isxdigit(x) (hexval_table[(x)] != -1)
>
> With that, couldn't you squeeze the other two classes into the existing
> sane_type?

No there are still conflicts: 9, 10 and 13 as spaces (vs controls) and
123, 124 and 126 as regex/pathspec special (vs punctuation).

> By the way, I'm working on a patch series for implementing a lot more
> character classes with table lookups.  It grew out of a desire to make
> bad_ref_char() faster but perhaps got a bit out of hand by now; it's at 24
> patches and still not finished.  I'm curious how long we have until it
> escapes. ;-)

I don't think the series is going to graduate any time soon :)
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]