[patch][committed] Fix second instance of BZ #18043

Paul Eggert eggert@cs.ucla.edu
Mon Mar 9 18:19:00 GMT 2015


On 03/09/2015 07:28 AM, Paul Pluzhnikov wrote:
> -	  if (strchr ("-=?+", words[1 + *offset]) == NULL)
> +	  if (words[1 + *offset] == '\0'
> +	      || strchr ("-=?+", words[1 + *offset]) == NULL)

For stuff like this, how about using memchr instead?  E.g.,:

    if (! memchr ("-=?+", words[1 + *offset]. sizeof "-=?+" - 1))

This could be done with a macro that uses 'sizeof'.  This would make the 
code smaller and arguably easier to read.



More information about the Libc-alpha mailing list