[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: Jesper Louis Andersen <jlouis_at_mongers.org>
Date: 2004-11-15 10:33:50 CET

Quoting Branko ??ibej (brane@xbc.nu):
> You misread what I posted.

Oops!

Yes, I see the point. Here is what I have done:

First, I expanded the tests so we now test 5 equivalence classes:
  * The character is in the middle of the string
  * The character is at the very beginning of the string
  * The character is at the very end of the string
  * The character is not in the string at all
  * The string has len 0

Next, I verified that my implementation fails. It does ;)

Then, I changed to your implementation, correctly this time, and
  verified it works.

--- Log Message ---
Eliminate signedness problems of find_char_backward in string types

The functions svn_string_find_char_backward and
svn_stringbuf_find_char_backward suffers from a signedness problem
when allocating very big strings. The signed counter will be
initialized to a negative number and the search-loop will never
execute. This change alters the loop to a downward counting one
and makes the counter an apr_size_t, thus eliminating the signedness
problem.

Also, the change hoists common logic for the functions
svn_string_find_char_backward and svn_stringbuf_find_char_backward
into a common function string__find_char_backward.

Expanded the regression test suite with 5 equivalence classes for
svn_stringbuf_find_char_backward:

  * The character is in the middle of the string
  * The character is at the very beginning of the string
  * The character is at the very end of the string
  * The character is not in the string at all
  * The string has len 0

--- Log message ---

Patch attached.

-- 
jlouis


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Mon Nov 15 10:34:17 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.