Re: [PATCHv2 1/2] git apply: option to ignore whitespace differences
- From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
- Date
- Jul 5, 2009, 23:21 UTC
- Message-ID
- <4A513560.5040001@ramsay1.demon.co.uk>
- In-Reply-To
- <1246708429-21823-2-git-send-email-giuseppe.bilotta@gmail.com>
[Sorry for the late reply to this; I've been catching up on email after several days away - so if this has already been addressed, just ignore and sorry for the noise!]
Giuseppe Bilotta wrote: [snip]
Show 7 quoted lines
> + * Compare s1 to s2 up to length n, ignoring whitespace differences.
> + * It is acceptable if s2 is a substring of s1.
> + */
> +static int memcmp_ignore_whitespace(const char *s1, const char *s2, size_t n)
> +{
> + const char *stop = s2 + n;
> + int result;result is uninitialized here...
Show 10 quoted lines
> +
> + if (!n)
> + return 0;
> +
> + /* skip leading whitespace */
> + while (isspace(*s1))
> + s1++;
> + while (isspace(*s2))
> + s2++;
> + while (!result && s2 < stop) {... and is still uninitialized the first time it hits the loop condition...
> + result = *s1++ - *s2++;
... so this may or may not be set...
Show 13 quoted lines
> + /*
> + * skip whitespace inside if we have whitespace
> + * on both buffers
> + */
> + if (isspace(*s1) && isspace(*s2)) {
> + while (isspace(*s1))
> + s1++;
> + while (isspace(*s2))
> + s2++;
> + }
> + }
> +
> + return result;... so this may still be uninitialized.
> +} > +
I haven't been following this thread; I just noticed this problem as the patch floated past...
ATB, Ramsay Jones