[PATCH][BZ #15346] Allow leading and trailing spaces in getdate
Rich Felker
dalias@aerifal.cx
Mon Apr 8 22:15:00 GMT 2013
On Mon, Apr 08, 2013 at 01:12:56PM -0700, Roland McGrath wrote:
> > + /* Skip leading spaces. */
>
> s/spaces/whitespace/
>
> > + while (string[i] && isspace (string[i]))
> > + i++;
>
> Avoid Boolean coercion: string[i] != '\0'.
> But since you've already done strlen, why not i < inlen?
I don't think it matters here, but in general the idiom of testing for
a zero byte is superior to comparing against the length, because it
involves one fewer variables (and thus less register pressure) in the
loop.
Rich
More information about the Libc-alpha
mailing list