This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch][committed] Fix second instance of BZ #18043
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Paul Pluzhnikov <ppluzhnikov at gmail dot com>, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Mon, 09 Mar 2015 11:19:51 -0700
- Subject: Re: [patch][committed] Fix second instance of BZ #18043
- Authentication-results: sourceware.org; auth=none
- References: <CALoOobM_bLg9CtR5vF+nfnhVtoZhKKo8extbCwAwmkNAPOSVLg at mail dot gmail dot com>
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.