Re: [PATCH] Correct dir.c to compile on Solaris 9

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

 



Robin Rosenberg <robin.rosenberg.lists@xxxxxxxxxx> writes:

> The table lookup *is* faster (meastured), but that doesn't make a big difference
> on the total CPU used. The muliple-case-per line thing (both versions, however makes is hard
> to read.  
>
> -- robin
>
> diff --git a/dir.c b/dir.c
> index 7426fde..0780f23 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -423,12 +423,22 @@ static int cmp_name(const void *p1, const void *p2)
>   */
>  static int simple_length(const char *match)
>  {
> -       const char special[256] = {
> -               [0] = 1, ['?'] = 1,
> -               ['\\'] = 1, ['*'] = 1,
> -               ['['] = 1
> -       };
>         int len = -1;
> +       static const char special[256] = {
> +               1,0,0,0,0,0,0,0, /* nul */
> +               0,0,0,0,0,0,0,0,
> +               0,0,0,0,0,0,0,0,
> +               0,0,0,0,0,0,0,0,
> +               0,0,0,0,0,0,0,0,
> +               0,0,1,0,0,0,0,0, /* * */

I wonder if folding this into ctype.c::sane_ctype[] is an
option...

-
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]