summaryrefslogtreecommitdiff
path: root/fs/unicode/utf8n.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-09-15 10:00:04 +0300
committerGabriel Krisman Bertazi <krisman@collabora.com>2021-10-11 23:02:02 +0300
commit6ca99ce756c27852d1ea1e555045de1c920f30ed (patch)
tree3cedb519da25bfe7e8c3cce48f03c47599ce953e /fs/unicode/utf8n.h
parentfbc59d65059ecfea8b746715e920c325cc16cede (diff)
downloadlinux-6ca99ce756c27852d1ea1e555045de1c920f30ed.tar.xz
unicode: cache the normalization tables in struct unicode_map
Instead of repeatedly looking up the version add pointers to the NFD and NFD+CF tables to struct unicode_map, and pass a unicode_map plus index to the functions using the normalization tables. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Diffstat (limited to 'fs/unicode/utf8n.h')
-rw-r--r--fs/unicode/utf8n.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/unicode/utf8n.h b/fs/unicode/utf8n.h
index 736b6460a38c..206c89f0dbf7 100644
--- a/fs/unicode/utf8n.h
+++ b/fs/unicode/utf8n.h
@@ -39,7 +39,8 @@ extern const struct utf8data *utf8nfdicf(unsigned int maxage);
* Returns 0 if only ignorable code points are present.
* Returns -1 if the input is not valid UTF-8.
*/
-extern ssize_t utf8nlen(const struct utf8data *data, const char *s, size_t len);
+ssize_t utf8nlen(const struct unicode_map *um, enum utf8_normalization n,
+ const char *s, size_t len);
/* Needed in struct utf8cursor below. */
#define UTF8HANGULLEAF (12)
@@ -48,7 +49,8 @@ extern ssize_t utf8nlen(const struct utf8data *data, const char *s, size_t len);
* Cursor structure used by the normalizer.
*/
struct utf8cursor {
- const struct utf8data *data;
+ const struct unicode_map *um;
+ enum utf8_normalization n;
const char *s;
const char *p;
const char *ss;
@@ -65,8 +67,8 @@ struct utf8cursor {
* Returns 0 on success.
* Returns -1 on failure.
*/
-extern int utf8ncursor(struct utf8cursor *u8c, const struct utf8data *data,
- const char *s, size_t len);
+int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um,
+ enum utf8_normalization n, const char *s, size_t len);
/*
* Get the next byte in the normalization.