Re: [PATCH v2 13/13] vt: refresh ucs_width_table.h and adjust code in ucs.c accordingly

From: Jiri Slaby
Date: Wed Apr 16 2025 - 01:12:55 EST


On 15. 04. 25, 21:18, Nicolas Pitre wrote:
From: Nicolas Pitre <npitre@xxxxxxxxxxxx>

Width tables are now split into BMP (16-bit) and non-BMP (above 16-bit).
This reduces the corresponding text size by 20-25%.

Note: scripts/checkpatch.pl complains about "... exceeds 100 columns".
Please ignore.
...
--- a/drivers/tty/vt/ucs.c
+++ b/drivers/tty/vt/ucs.c
@@ -5,17 +5,34 @@
...
-static int interval_cmp(const void *key, const void *element)
+static int interval16_cmp(const void *key, const void *element)
+{
+ u16 cp = *(u16 *)key;

You cast away const. Does the compiler not complain?

+ const struct ucs_interval16 *entry = element;
+
+ if (cp < entry->first)
+ return -1;
+ if (cp > entry->last)
+ return 1;
+ return 0;
+}
+
+static int interval32_cmp(const void *key, const void *element)
{
u32 cp = *(u32 *)key;

Apparently not, given we do this for ages. I wonder why?

Anyway:

Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx>

--
js
suse labs