Jesper Louis Andersen <>


r852052 | brane | 2004-11-21 22:57:00 +0000 (Sun, 21 Nov 2004)

Cleanup of and new tests for the strings implementation.

Patch by: Jesper Louis Andersen <>

* subversion/libsvn_subr/svn_string.c
  (string_compare, string_first_non_whitespace): New helper functions.
  (find_char_backward): New helper functions. Fixes a signedness issue
   by using an unsigned loop counter.
  (svn_string_compare, svn_stringbuf_compare, svn_string_compare_stringbuf):
   Replace implmentation with call to string_compare.
  (svn_string_first_non_whitespace, svn_stringbuf_first_non_whitespace):
   Replace implementation with call to string_first_non_whitespace.
  (svn_string_find_char_backward, svn_stringbuf_find_char_backward):
   Replace implementation with call to find_char_backward.
  (svn_stringbuf_ensure): Document apr_size_t overflow check.

* subversion/tests/libsvn_subr/string-test.c
  (test_find_char_backward): New helper function.
  (test13, test14, test15, test16, test17):
   New tests; use test_find_char_backward.
  (test_first_non_whitespace): New helper function.
  (test18, test19, test20): New tests; use test_first_non_whitespace.
  (test21): New test for svn_stringbuf_strip_whitespace.
  (test_string_compare): New helper function. 
  (test22, test23): New tests; use test_string_compare.
  (test_funcs[]): Updated with new tests.