* lib/regex_internal.c (build_wcs_upper_buffer):
Omit cast from char * to char *.
* lib/regex_internal.h (re_string_wchar_at):
Omit casts to wint_t in a context that will already convert to wint_t.
---
 ChangeLog            | 6 ++++++
 lib/regex_internal.c | 2 +-
 lib/regex_internal.h | 4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 76659f6a60..5a5b39447a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2026-05-10  Paul Eggert  <[email protected]>
 
+       regex: omit useless casts
+       * lib/regex_internal.c (build_wcs_upper_buffer):
+       Omit cast from char * to char *.
+       * lib/regex_internal.h (re_string_wchar_at):
+       Omit casts to wint_t in a context that will already convert to wint_t.
+
        manywarnings: fix -Wuseless-cast cataloging
        * build-aux/gcc-warning.spec: Mention -Wuseless-cast as a special case.
 
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index af4b41bcdb..ad1b273546 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -387,7 +387,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
              {
                size_t mbcdlen;
 
-               mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st);
+               mbcdlen = __wcrtomb (buf, wcu, &prev_st);
                if (__glibc_likely (mbclen == mbcdlen))
                  memcpy (pstr->mbs + byte_idx, buf, mbclen);
                else if (mbcdlen != (size_t) -1)
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index e24ef97989..1ffa905e95 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -789,8 +789,8 @@ __attribute__ ((pure, unused))
 re_string_wchar_at (const re_string_t *pstr, Idx idx)
 {
   if (pstr->mb_cur_max == 1)
-    return (wint_t) pstr->mbs[idx];
-  return (wint_t) pstr->wcs[idx];
+    return pstr->mbs[idx];
+  return pstr->wcs[idx];
 }
 
 #ifdef _LIBC
-- 
2.54.0


Reply via email to