In commentary, say "an initial state" rather than "the initial state" for mbstate_t, as it is possible and indeed common for there to be more than one initial state. POSIX routinely says "an initial state". --- lib/c32srtombs-state.c | 2 +- lib/mbfile.h | 2 +- lib/mbiter.h | 2 +- lib/mbrtoc32.c | 2 +- lib/mbsinit.c | 2 +- lib/mbsrtoc32s-state.c | 2 +- lib/mbsrtowcs-state.c | 2 +- lib/mbtowc-lock.h | 2 +- lib/mbuiter.h | 2 +- lib/wchar.in.h | 2 +- lib/wcrtomb.c | 2 +- lib/wcsrtombs-state.c | 2 +- tests/test-mbrtoc32-regular.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/c32srtombs-state.c b/lib/c32srtombs-state.c index 8bd5ea32b5..c1d72e186d 100644 --- a/lib/c32srtombs-state.c +++ b/lib/c32srtombs-state.c @@ -21,7 +21,7 @@ /* Internal state used by the functions c32srtombs() and c32snrtombs(). */ mbstate_t _gl_c32srtombs_state -/* The state must initially be in the "initial state"; so, zero-initialize it. +/* The state must initially be in an "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works diff --git a/lib/mbfile.h b/lib/mbfile.h index ee1dd5a4b9..6c971e64ab 100644 --- a/lib/mbfile.h +++ b/lib/mbfile.h @@ -95,7 +95,7 @@ mbfile_multi_getc (struct mbchar *mbc, struct mbfile_multi *mbf) new_bufcount = mbf->bufcount; - /* If mbf->state is not in the initial state, some more 32-bit wide character + /* If mbf->state is not in an initial state, some more 32-bit wide character may be hiding in the state. We need to call mbrtoc32 again. */ if (mbsinit (&mbf->state)) { diff --git a/lib/mbiter.h b/lib/mbiter.h index 8bd83d7262..963ccff1f7 100644 --- a/lib/mbiter.h +++ b/lib/mbiter.h @@ -175,7 +175,7 @@ mbiter_multi_next (struct mbiter_multi *iter) iter->cur.bytes = 0; iter->cur.wc_valid = true; - /* When in the initial state, we can go back treating ASCII + /* When in an initial state, we can go back treating ASCII characters more quickly. */ if (mbsinit (&iter->state)) iter->in_shift = false; diff --git a/lib/mbrtoc32.c b/lib/mbrtoc32.c index 96039f9480..52bdde2482 100644 --- a/lib/mbrtoc32.c +++ b/lib/mbrtoc32.c @@ -203,7 +203,7 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps) if (nstate >= (res > 0 ? res : 1)) abort (); res -= nstate; - /* Set *ps to the initial state. */ + /* Set *ps to an initial state. */ # if defined _WIN32 && !defined __CYGWIN__ /* Native Windows. */ /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter. diff --git a/lib/mbsinit.c b/lib/mbsinit.c index 6e600798d1..85b6087cf4 100644 --- a/lib/mbsinit.c +++ b/lib/mbsinit.c @@ -36,7 +36,7 @@ buffered bytes (in the range 0..3), followed by up to 3 buffered bytes. See mbrtowc.c. - In wc -> mb direction, mbstate_t contains no information. In other - words, it is always in the initial state. */ + words, it is always in an initial state. */ static_assert (sizeof (mbstate_t) >= 4); diff --git a/lib/mbsrtoc32s-state.c b/lib/mbsrtoc32s-state.c index 91a18fdd74..a37799bccf 100644 --- a/lib/mbsrtoc32s-state.c +++ b/lib/mbsrtoc32s-state.c @@ -21,7 +21,7 @@ /* Internal state used by the functions mbsrtoc32s() and mbsnrtoc32s(). */ mbstate_t _gl_mbsrtoc32s_state -/* The state must initially be in the "initial state"; so, zero-initialize it. +/* The state must initially be in an "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works diff --git a/lib/mbsrtowcs-state.c b/lib/mbsrtowcs-state.c index 0949a370c8..adb617fdec 100644 --- a/lib/mbsrtowcs-state.c +++ b/lib/mbsrtowcs-state.c @@ -21,7 +21,7 @@ /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ mbstate_t _gl_mbsrtowcs_state -/* The state must initially be in the "initial state"; so, zero-initialize it. +/* The state must initially be in an "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h index 2dc22ace72..beb37722f5 100644 --- a/lib/mbtowc-lock.h +++ b/lib/mbtowc-lock.h @@ -21,7 +21,7 @@ static inline int mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m) { - /* Put the hidden internal state of mbtowc into its initial state. + /* Put the hidden internal state of mbtowc into an initial state. This is needed at least with glibc, uClibc, and MSVC CRT. See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */ mbtowc (NULL, NULL, 0); diff --git a/lib/mbuiter.h b/lib/mbuiter.h index e0fcd03d3d..7900a48715 100644 --- a/lib/mbuiter.h +++ b/lib/mbuiter.h @@ -182,7 +182,7 @@ mbuiter_multi_next (struct mbuiter_multi *iter) iter->cur.bytes = 0; iter->cur.wc_valid = true; - /* When in the initial state, we can go back treating ASCII + /* When in an initial state, we can go back treating ASCII characters more quickly. */ if (mbsinit (&iter->state)) iter->in_shift = false; diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 75f3ed21ff..2c878ff815 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -288,7 +288,7 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - " #endif -/* Test whether *PS is in the initial state. */ +/* Test whether *PS is in an initial state. */ #if @GNULIB_MBSINIT@ # if @REPLACE_MBSINIT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/wcrtomb.c b/lib/wcrtomb.c index 48a6c8ebe6..389d699e5f 100644 --- a/lib/wcrtomb.c +++ b/lib/wcrtomb.c @@ -29,7 +29,7 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps) #undef wcrtomb { /* This implementation of wcrtomb supports only stateless encodings. - ps must be in the initial state. */ + ps must be in an initial state. */ if (ps != NULL && !mbsinit (ps)) { errno = EINVAL; diff --git a/lib/wcsrtombs-state.c b/lib/wcsrtombs-state.c index c7d47c472e..d38e8b6775 100644 --- a/lib/wcsrtombs-state.c +++ b/lib/wcsrtombs-state.c @@ -21,7 +21,7 @@ /* Internal state used by the functions wcsrtombs() and wcsnrtombs(). */ mbstate_t _gl_wcsrtombs_state -/* The state must initially be in the "initial state"; so, zero-initialize it. +/* The state must initially be in an "initial state"; so, zero-initialize it. On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>. When it needs an initializer, use 0 or {0} as initializer? 0 only works diff --git a/tests/test-mbrtoc32-regular.c b/tests/test-mbrtoc32-regular.c index a85a0a5a69..4ac8472330 100644 --- a/tests/test-mbrtoc32-regular.c +++ b/tests/test-mbrtoc32-regular.c @@ -61,7 +61,7 @@ main (int argc, char *argv[]) /* It is OK if this conversion fails. */ if (ret != (size_t)(-1)) { - /* mbrtoc32 being regular, means that STATE is in the initial state. */ + /* mbrtoc32 being regular, means that STATE is in an initial state. */ ASSERT (mbsinit (&state)); ret = mbrtoc32 (&c32, "", 0, &state); /* mbrtoc32 being regular, means that it returns (size_t)(-2), not -- 2.39.2