This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #15346] Allow leading and trailing spaces in getdate
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 8 Apr 2013 13:12:56 -0700 (PDT)
- Subject: Re: [PATCH][BZ #15346] Allow leading and trailing spaces in getdate
- References: <20130408125233 dot GS32556 at spoyarek dot pnq dot redhat dot com> <20130408132913 dot GA9017 at domone dot kolej dot mff dot cuni dot cz> <20130408141120 dot GA15689 at spoyarek dot pnq dot redhat dot com>
> + /* 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?
> + /* Skip trailing spaces. */
s/spaces/whitespace/
> + char *instr;
> + if (__libc_use_alloca (inlen + 1))
> + {
> + instr = alloca (inlen + 1);
> + }
Drop the braces here.