On 02/19/2014 02:20 PM, David Shea wrote:
On 02/19/2014 02:13 PM, Brian C. Lane wrote:
> - extraHeaders = realloc(extraHeaders, (len+1)*sizeof(char *));
> + /* Trim off any trailing newlines or spaces */
> + for (p=sn+strlen(sn); p != sn && !isspace(*p); p--);
> + *p = '\0';
Extra semicolon at the end of the "for"
Looking at it again, I guess that may have been intentional if you're
just trying to back p up to the first non-space. In that case, could you
make the body of the loop a continue statement so it clear that's what
you're doing? Also, it may make more sense to start with sn + strlen(sn)
- 1, so you're not testing isspace('\0') which I had to try out to make
sure it actually isn't a space (and change the conditional to p >= sn to
handle the empty string case). Also, include <ctype.h> for isspace.