Skip to contentSkip to conversation

utf8: Remove unused utf8_normalize

PATCH In review [email protected] 2 participants 2 messages Jun 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utf8: Remove unused utf8_normalize

From: "Dr. David Alan Gilbert" <[email protected]>

utf8_normalize() was added in 2019 as part of
commit 9d53690f0d4e ("unicode: implement higher level API for string handling")
but has remained unused.

(I think because the other higher level routines added by that patch normalise as part of their operations)

Remove it.

---
 fs/unicode/utf8-core.c  | 22 ----------------------
 include/linux/unicode.h |  3 ---
 2 files changed, 25 deletions(-)
fs/unicode/utf8-core.c +0 -22
index 6fc9ab8667e6..1a30447c4743 100644
@@ -138,28 +138,6 @@ int utf8_casefold_hash(const struct unicode_map *um, const void *salt,
 }
 EXPORT_SYMBOL(utf8_casefold_hash);
 
-int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
-		   unsigned char *dest, size_t dlen)
-{
-	struct utf8cursor cur;
-	ssize_t nlen = 0;
-
-	if (utf8ncursor(&cur, um, UTF8_NFDI, str->name, str->len) < 0)
-		return -EINVAL;
-
-	for (nlen = 0; nlen < dlen; nlen++) {
-		int c = utf8byte(&cur);
-
-		dest[nlen] = c;
-		if (!c)
-			return nlen;
-		if (c == -1)
-			break;
-	}
-	return -EINVAL;
-}
-EXPORT_SYMBOL(utf8_normalize);
-
 static const struct utf8data *find_table_version(const struct utf8data *table,
 		size_t nr_entries, unsigned int version)
 {
include/linux/unicode.h +0 -3
index 5e6b212a2aed..64fa44fe180c 100644
@@ -66,9 +66,6 @@ int utf8_strncasecmp_folded(const struct unicode_map *um,
 			    const struct qstr *cf,
 			    const struct qstr *s1);
 
-int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
-		   unsigned char *dest, size_t dlen);
-
 int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
 		  unsigned char *dest, size_t dlen);
 
Signature · 1 line
2.49.0
#1 lore raw
Quoted 6 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

utf8_normalize() was added in 2019 as part of
commit 9d53690f0d4e ("unicode: implement higher level API for string handling")
but has remained unused.

FWIW, the original implementation made use of it, but the normalization-only support was rightfully dropped before merging. Then, there was an intention to enable it later but it never materialized. It clearly can go away.

Quoted 2 lines

(I think because the other higher level routines added by that patch normalise as part of their operations)

Correct.

I'll queue it for next.

Thank you,

Signature · 1 line
Gabriel Krisman Bertazi