]> Savannah Git Hosting - gnulib.git/commitdiff
More than one initial mbstate_t
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Jul 2023 14:54:01 +0000 (07:54 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Jul 2023 14:54:01 +0000 (07:54 -0700)
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".

13 files changed:
lib/c32srtombs-state.c
lib/mbfile.h
lib/mbiter.h
lib/mbrtoc32.c
lib/mbsinit.c
lib/mbsrtoc32s-state.c
lib/mbsrtowcs-state.c
lib/mbtowc-lock.h
lib/mbuiter.h
lib/wchar.in.h
lib/wcrtomb.c
lib/wcsrtombs-state.c
tests/test-mbrtoc32-regular.c

index 8bd5ea32b543a6c943ad18c6785e0d735b7676ca..c1d72e186d44467598ce747f3ca65ae64d2505ae 100644 (file)
@@ -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
index ee1dd5a4b9961bca592640ca8811e5f5b261bcb2..6c971e64abd02a568a71f2d6a3fa94f3704ad922 100644 (file)
@@ -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))
     {
index 8bd83d7262b6a11c86f84d4d7d5068582f323924..963ccff1f7e0dd1986314110625dfd28161c9dbc 100644 (file)
@@ -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;
index 96039f9480888ede3e0497f8b49b68dadf43b70b..52bdde2482cb9a656b1cc7e363ccba33d5354308 100644 (file)
@@ -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.
index 6e600798d19b6e168705290ab9178ee73ca1a956..85b6087cf426ea1b0c2342b579579b3d56314941 100644 (file)
@@ -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);
 
index 91a18fdd7435176db62c826ac75067c537600670..a37799bccfa67d8fa1bbe392904ba60861e89130 100644 (file)
@@ -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
index 0949a370c8e775a0e92cfb4b7da5be8198459494..adb617fdec07b5ca03094c6ca6f8e317da3504af 100644 (file)
@@ -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
index 2dc22ace720a45f8614c4ef9db59ba02317bc294..beb37722f5e0db4a64b76635a124bb9bc8636478 100644 (file)
@@ -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);
index e0fcd03d3d0d20d5a1d5a044159ef5b1476a4eee..7900a48715099cb067e96bf8fdc636224de54472 100644 (file)
@@ -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;
index 75f3ed21ffa8e64daef8046934877519c7874b47..2c878ff8157a674e941cbd12e00afa064cc0a112 100644 (file)
@@ -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)
index 48a6c8ebe6841868800db79bf0c33d52353ed7a1..389d699e5f5cf25c333deb68a10949f75a2fa500 100644 (file)
@@ -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;
index c7d47c472ef303977e023da51cbf95821496c6b2..d38e8b6775dd3e5fbd4108e3633ed320a9365644 100644 (file)
@@ -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
index a85a0a5a6960e0353897fc4f9ecd74403c74c9a3..4ac84723309a03be783d6e09c48f5d7b2f045f68 100644 (file)
@@ -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