This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]