[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] lib/glob/smatch.c: fix build failure when multibyte support
|
From: |
Shubham Chakraborty |
|
Subject: |
[PATCH 4/4] lib/glob/smatch.c: fix build failure when multibyte support is disabled |
|
Date: |
Mon, 13 Jul 2026 15:35:26 +0530 |
When multibyte support is disabled, locale_utf8locale and
UTF8_SINGLEBYTE are not available. This causes a compilation error in
lib/glob/smatch.c in functions like is_cclass, collseqcmp, and the FOLD
macro.
This fixes the following failure seen with br-arm-basic toolchain:
strmatch.c:145:7: error: 'locale_utf8locale' undeclared (first use in this
function)
145 | if (locale_utf8locale && (UTF8_SINGLEBYTE (c) == 0 || UTF8_SINGLEBYTE
(equiv) == 0))
Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
---
lib/glob/smatch.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c
index e42b8fc..b437062 100644
--- a/lib/glob/smatch.c
+++ b/lib/glob/smatch.c
@@ -141,9 +141,11 @@ rangecmp (int c1, int c2, int forcecoll)
static int
collseqcmp (int c, int equiv)
{
+#if HANDLE_MULTIBYTE
/* Make sure characters >= 0x80 are compared as bytes in a UTF-8 locale. */
if (locale_utf8locale && (UTF8_SINGLEBYTE (c) == 0 || UTF8_SINGLEBYTE
(equiv) == 0))
return (c == equiv);
+#endif
if (charcmp (c, equiv, 1) == 0)
return 1;
@@ -285,8 +287,10 @@ is_cclass (int c, const char *name)
enum char_class char_class;
int result;
+#if HANDLE_MULTIBYTE
if (locale_utf8locale && UTF8_SINGLEBYTE (c) == 0)
return -1;
+#endif
char_class = is_valid_cclass (name);
if (char_class == CC_NO_CLASS)
@@ -298,10 +302,17 @@ is_cclass (int c, const char *name)
/* Now include `sm_loop.c' for single-byte characters. */
/* The result of FOLD is an `unsigned char' */
+#if HANDLE_MULTIBYTE
# define FOLD(c) \
(((flags & FNM_CASEFOLD) && (locale_utf8locale == 0 || UTF8_SINGLEBYTE (c)))
\
? TOLOWER ((unsigned char)c) \
: ((unsigned char)c))
+#else
+# define FOLD(c) \
+ ((flags & FNM_CASEFOLD) \
+ ? TOLOWER ((unsigned char)c) \
+ : ((unsigned char)c))
+#endif
#if !defined (__CYGWIN__)
# define ISDIRSEP(c) ((c) == '/')
--
2.55.0
- [PATCH 0/4] Fix build failures when multibyte support is disabled, Shubham Chakraborty, 2026/07/13
- [PATCH 1/4] builtins/printf.def: fix build when HANDLE_MULTIBYTE is undefined, Shubham Chakraborty, 2026/07/13
- [PATCH 2/4] lib/glob/glob.c: fix build failure when multibyte support is disabled, Shubham Chakraborty, 2026/07/13
- [PATCH 3/4] builtins/printf.def: fix type mismatch in tescape call, Shubham Chakraborty, 2026/07/13
- [PATCH 4/4] lib/glob/smatch.c: fix build failure when multibyte support is disabled,
Shubham Chakraborty <=
- Re: [PATCH 0/4] Fix build failures when multibyte support is disabled, Chet Ramey, 2026/07/13
- [PATCH v2 0/4] Fix build failures when multibyte support is disabled, Shubham Chakraborty, 2026/07/14