[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Nitpick to libsvn_subr/svn_string.c

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-11-14 20:15:27 CET

Jesper Louis Andersen wrote:

>Quoting Branko ??ibej (brane@xbc.nu):
>
>
>
>>I guess we could argue backwards and forwards and produce numbers that
>>support both positions, while compilers get smarter and smarter... but I
>>don't think it's worth it. Let's just fix the signedness issue you
>>found, and leave it at that.
>>
>>
>
>New patch. With the changes you suggested.
>
>Beware that your
>
>while(i != 0)
> {
> if (str[i--] == ch)
> return i;
>...
>
>will not return the char at position i, but the char at position i-1
>due to the i--. The patch below for-loops it correctly (I, I love
>regression checks).
>
>
You misread what I posted. I wrote "str[--i]", not "str[i--]", and the
difference is crucial. Your change is wrong because a) the first
character it checks is str[len], which is always 0, and b) it never
checks str[0]. I propose you expand the tests, because none of them
catches this bug.

Before fixing this, please read HACKING and post a log message along
with the patch. Oh, also please fix the alignment of the paramters in
test13, test14 and test15.

Keep trying, you're almost there. :-)

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 14 20:16:01 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.