And another correction to this module and the subsequent ones:

2025-02-20  Bruno Haible  <br...@clisp.org>

        *_l: Fix mistake.
        * lib/is_l-impl.h (FUNC): Fix array index on old NetBSD and OpenBSD.
        * lib/to_l-impl.h (FUNC): Likewise.
        * lib/strcasecmp_l.c (strcasecmp_l): Likewise.
        * lib/strncasecmp_l.c (strncasecmp_l): Likewise.
        * lib/strerror_l.c (strerror_l_r): Likewise.

diff --git a/lib/is_l-impl.h b/lib/is_l-impl.h
index 27de6de898..46946e97bd 100644
--- a/lib/is_l-impl.h
+++ b/lib/is_l-impl.h
@@ -23,7 +23,7 @@ int
 FUNC (int c, locale_t locale)
 {
   struct gl_locale_category_t *plc =
-    &locale->category[gl_log2_lc_mask (LC_CTYPE)];
+    &locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_CTYPE))];
   if (plc->is_c_locale)
     /* Implementation for the "C" locale.  */
     return C_FUNC (c);
diff --git a/lib/strcasecmp_l.c b/lib/strcasecmp_l.c
index 6ed2a72f8d..07ffee2f7f 100644
--- a/lib/strcasecmp_l.c
+++ b/lib/strcasecmp_l.c
@@ -29,7 +29,7 @@ strcasecmp_l (const char *s1, const char *s2, locale_t locale)
 #if GNULIB_defined_locale_t
 
   struct gl_locale_category_t *plc =
-    &locale->category[gl_log2_lc_mask (LC_CTYPE)];
+    &locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_CTYPE))];
   if (plc->is_c_locale)
     /* Implementation for the "C" locale.  */
     return c_strcasecmp (s1, s2);
diff --git a/lib/strerror_l.c b/lib/strerror_l.c
index 1c2764c5f7..8203088a55 100644
--- a/lib/strerror_l.c
+++ b/lib/strerror_l.c
@@ -120,7 +120,7 @@ strerror_l_r (int errnum, char *buf, size_t buflen, 
locale_t locale)
 #if GNULIB_defined_locale_t
 
   struct gl_locale_category_t *plc =
-    &locale->category[gl_log2_lc_mask (LC_MESSAGES)];
+    &locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_MESSAGES))];
   if (plc->is_c_locale)
     {
       /* Implementation for the "C" locale.  */
diff --git a/lib/strncasecmp_l.c b/lib/strncasecmp_l.c
index c049015caf..04219c5c95 100644
--- a/lib/strncasecmp_l.c
+++ b/lib/strncasecmp_l.c
@@ -29,7 +29,7 @@ strncasecmp_l (const char *s1, const char *s2, size_t n, 
locale_t locale)
 #if GNULIB_defined_locale_t
 
   struct gl_locale_category_t *plc =
-    &locale->category[gl_log2_lc_mask (LC_CTYPE)];
+    &locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_CTYPE))];
   if (plc->is_c_locale)
     /* Implementation for the "C" locale.  */
     return c_strncasecmp (s1, s2, n);
diff --git a/lib/to_l-impl.h b/lib/to_l-impl.h
index 63816aee3c..d7bd166cc1 100644
--- a/lib/to_l-impl.h
+++ b/lib/to_l-impl.h
@@ -23,7 +23,7 @@ int
 FUNC (int c, locale_t locale)
 {
   struct gl_locale_category_t *plc =
-    &locale->category[gl_log2_lc_mask (LC_CTYPE)];
+    &locale->category[gl_log2_lcmask_to_index (gl_log2_lc_mask (LC_CTYPE))];
   if (plc->is_c_locale)
     /* Implementation for the "C" locale.  */
     return C_FUNC (c);




Reply via email to