From: Bruno Haible Date: Sun, 11 Feb 2007 17:41:22 +0000 (+0000) Subject: Fix bug. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbf9862a303918c47e8aa8e739fab84aa5373e16;p=pspp Fix bug. New tests. --- diff --git a/ChangeLog b/ChangeLog index a763008e5c..c521d8617c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-02-11 Bruno Haible + + * 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 Support for copying multibyte string iterators. diff --git a/lib/mbschr.c b/lib/mbschr.c index 084694d7a6..2dc5866a0c 100644 --- a/lib/mbschr.c +++ b/lib/mbschr.c @@ -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: