for (mcel_t g2; logical_p < logical_lim; logical_p += g2.len)
{
g2 = mcel_scan (logical_p, logical_lim);
- if (c32isblank (g2.ch))
+ if (c32isblank (g2.ch) && ! c32isnbspace (g2.ch))
{
space_length = g2.len;
logical_end = logical_p - line_out;
#include <stdckdint.h>
#include <stddef.h>
#include <string.h>
+#include <uchar.h>
#include <errno.h>
/* Some systems don't define this; POSIX mentions it but says it is
errors that the cast doesn't. */
static inline unsigned char to_uchar (char ch) { return ch; }
+/* Return non zero if a non breaking space. */
+ATTRIBUTE_PURE
+static inline int
+c32isnbspace (char32_t wc)
+{
+ return wc == 0x00A0 || wc == 0x2007 || wc == 0x202F || wc == 0x2060;
+}
+
#include <locale.h>
/* Take care of NLS matters. */
exit (status);
}
-/* Return non zero if a non breaking space. */
+/* Return non zero if POSIXLY_CORRECT is not set and WC is a non breaking
+ space. */
ATTRIBUTE_PURE
static int
-iswnbspace (wint_t wc)
+maybe_c32isnbspace (char32_t wc)
{
- return ! posixly_correct
- && (wc == 0x00A0 || wc == 0x2007
- || wc == 0x202F || wc == 0x2060);
+ return ! posixly_correct && c32isnbspace (wc);
}
/* FILE is the name of the file (or null for standard input)
if (width > 0)
linepos += width;
}
- in_word2 = ! iswspace (wide_char)
- && ! iswnbspace (wide_char);
+ in_word2 = (! iswspace (wide_char)
+ && ! maybe_c32isnbspace (wide_char));
}
/* Count words by counting word starts, i.e., each
wc_isprint[i] = !!isprint (i);
if (print_words)
for (int i = 0; i <= UCHAR_MAX; i++)
- wc_isspace[i] = isspace (i) || iswnbspace (btoc32 (i));
+ wc_isspace[i] = isspace (i) || maybe_c32isnbspace (btoc32 (i));
bool read_tokens = false;
struct argv_iterator *ai;