[PATCH 3/4] Use proper extern declaration for _nl_C_LC_CTYPE_{class,toupper,tolower}

Florian Weimer fweimer@redhat.com
Thu Dec 19 20:58:21 GMT 2024


The existing initializers already contain explicit casts.  Keep them
due to int/uint32_t mismatch.
---
 ctype/ctype-info.c | 3 ---
 include/ctype.h    | 5 +++++
 locale/xlocale.c   | 7 +------
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c
index 71d1c8e3b4..94e312d91f 100644
--- a/ctype/ctype-info.c
+++ b/ctype/ctype-info.c
@@ -41,10 +41,7 @@ libc_hidden_def (__ctype_init)
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
 
 /* Defined in locale/C-ctype.c.  */
-extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
 extern const char _nl_C_LC_CTYPE_class32[] attribute_hidden;
-extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
-extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden;
 extern const char _nl_C_LC_CTYPE_class_upper[] attribute_hidden;
 extern const char _nl_C_LC_CTYPE_class_lower[] attribute_hidden;
 extern const char _nl_C_LC_CTYPE_class_alpha[] attribute_hidden;
diff --git a/include/ctype.h b/include/ctype.h
index 0f6e7fc7ea..a15e5b6678 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -66,6 +66,11 @@ __ctype_tolower_loc (void)
 #   define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
 #  endif  /* Not __NO_CTYPE.  */
 
+/* For use in initializers.  */
+extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
+extern const uint32_t _nl_C_LC_CTYPE_toupper[] attribute_hidden;
+extern const uint32_t _nl_C_LC_CTYPE_tolower[] attribute_hidden;
+
 # endif	/* IS_IN (libc).  */
 #endif  /* Not _ISOMAC.  */
 
diff --git a/locale/xlocale.c b/locale/xlocale.c
index f2b9d03303..d11c1cbf8c 100644
--- a/locale/xlocale.c
+++ b/locale/xlocale.c
@@ -18,18 +18,13 @@
 
 #include <locale.h>
 #include "localeinfo.h"
+#include <ctype.h>
 
 #define DEFINE_CATEGORY(category, category_name, items, a) \
 extern struct __locale_data _nl_C_##category;
 #include "categories.def"
 #undef	DEFINE_CATEGORY
 
-/* Defined in locale/C-ctype.c.  */
-extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
-extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
-extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden;
-
-
 const struct __locale_struct _nl_C_locobj attribute_hidden =
   {
     .__locales =
-- 
2.47.1




More information about the Libc-alpha mailing list