Fix bug.
authorBruno Haible <bruno@clisp.org>
Sun, 11 Feb 2007 17:41:22 +0000 (17:41 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Feb 2007 17:41:22 +0000 (17:41 +0000)
New tests.

ChangeLog
lib/mbschr.c

index a763008..c521d86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2007-02-11  Bruno Haible  <bruno@clisp.org>
 
+       * lib/mbschr.c (mbschr): Fix bug.
+
+       * modules/mbschr-tests: New file.
+       * tests/test-mbschr.sh: New file.
+       * tests/test-mbschr.c: New file.
+       * m4/locale-zh.m4: New file.
+
+2007-02-11  Bruno Haible  <bruno@clisp.org>
+
        Support for copying multibyte string iterators.
        * lib/mbiter.h: Include <string.h>.
        (mbiter_multi_copy): New function.
index 084694d..2dc5866 100644 (file)
@@ -41,11 +41,11 @@ mbschr (const char *string, int c)
 
       for (mbui_init (iter, string);; mbui_advance (iter))
        {
+         if (!mbui_avail (iter))
+           goto notfound;
          if (mb_len (mbui_cur (iter)) == 1
              && (unsigned char) * mbui_cur_ptr (iter) == (unsigned char) c)
            break;
-         if (!mbui_avail (iter))
-           goto notfound;
        }
       return (char *) mbui_cur_ptr (iter);
      notfound: