]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cut: optimize -d '?' in UTF-8 case
authorPádraig Brady <P@draigBrady.com>
Tue, 17 Mar 2026 14:17:06 +0000 (14:17 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 5 Apr 2026 12:15:56 +0000 (13:15 +0100)
ensure all ascii delims are processed with byte search in UTF-8

src/cut.c

index c89b3a2ef6777856675ab13e357b944db5165663..0e4d844be93dd5289f5e5a8141a9e7c11769af1a 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -315,8 +315,11 @@ utf8_field_delim_ok (void)
 static inline bool
 bytesearch_field_delim_ok (void)
 {
+  unsigned char delim_0 = delim_bytes[0];
+
   return (delim_length == 1
-          ? MB_CUR_MAX <= 1 || to_uchar (delim_bytes[0]) < 0x30
+          ? (MB_CUR_MAX <= 1
+             || (is_utf8_charset () ? delim_0 < 0x80 : delim_0 < 0x30))
           : utf8_field_delim_ok ());
 }