aboutsummaryrefslogtreecommitdiff
path: root/lib/unicode/prop/uprop_get_nfkc_scf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicode/prop/uprop_get_nfkc_scf.c')
-rw-r--r--lib/unicode/prop/uprop_get_nfkc_scf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/unicode/prop/uprop_get_nfkc_scf.c b/lib/unicode/prop/uprop_get_nfkc_scf.c
index 1738874..3c870d8 100644
--- a/lib/unicode/prop/uprop_get_nfkc_scf.c
+++ b/lib/unicode/prop/uprop_get_nfkc_scf.c
@@ -3,7 +3,6 @@
#include "macros.h"
#include "unicode/prop.h"
-#define M(...) ((struct rview)_(__VA_ARGS__))
#define _(...) \
{(const rune []){__VA_ARGS__}, lengthof(((const rune []){__VA_ARGS__}))}
@@ -17698,7 +17697,10 @@ static const struct rview stage2[][256] = {
struct rview
uprop_get_nfkc_scf(rune ch)
{
+ static thread_local rune hack;
struct rview rv = stage2[stage1[ch / 256]][ch % 256];
- /* TODO: This returns a pointer to a stack-allocated array; fix this! */
- return rv.len == 1 && rv.p[0] == SENTINAL ? M(ch) : rv;
+ if (rv.len != 1 || rv.p[0] != SENTINAL)
+ return rv;
+ hack = ch;
+ return (struct rview){&hack, 1};
}