Mercurial > hg > octave-nkf > gnulib-hg
changeset 8142:fccfb6a55bab
Fix bug. Remove unnecessary strlen call.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 11 Feb 2007 22:38:58 +0000 |
parents | 067fb541e9ea |
children | 17888c92ae41 |
files | ChangeLog lib/mbsspn.c |
diffstat | 2 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-02-11 Bruno Haible <bruno@clisp.org> + * lib/mbsspn.c (mbsspn): Fix bug. Remove unnecessary strlen call. + * modules/mbsspn-tests: New file. * tests/test-mbsspn.sh: New file. * tests/test-mbsspn.c: New file.
--- a/lib/mbsspn.c +++ b/lib/mbsspn.c @@ -47,8 +47,8 @@ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) if (!(mb_len (mbui_cur (iter)) == 1 && (unsigned char) * mbui_cur_ptr (iter) == uc)) - return mbui_cur_ptr (iter) - string; - return strlen (string); + break; + return mbui_cur_ptr (iter) - string; } else #endif @@ -71,25 +71,24 @@ { if (mb_len (mbui_cur (iter)) == 1) { - if (mbschr (reject, (unsigned char) * mbui_cur_ptr (iter)) == NULL) - return mbui_cur_ptr (iter) - string; + if (mbschr (reject, * mbui_cur_ptr (iter)) == NULL) + goto found; } else { mbui_iterator_t aiter; - for (mbui_init (aiter, reject); - mbui_avail (aiter); - mbui_advance (aiter)) + for (mbui_init (aiter, reject);; mbui_advance (aiter)) { if (!mbui_avail (aiter)) - return mbui_cur_ptr (iter) - string; + goto found; if (mb_equal (mbui_cur (aiter), mbui_cur (iter))) break; } } } - return strlen (string); + found: + return mbui_cur_ptr (iter) - string; } else #endif