diff options
| author | Thomas Voss <mail@thomasvoss.com> | 2024-05-09 16:34:09 +0200 | 
|---|---|---|
| committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-09 16:34:09 +0200 | 
| commit | a44c7e09d9b3504fdc26253840728e517fa9f598 (patch) | |
| tree | 2d86f17d3df9c2776937c1926bb61d296811639f /lib/unicode/prop/uprop_get_tc.c | |
| parent | 7059e4e133b62f5ad3339d51966f226089532710 (diff) | |
Fix bug where pointer to local was returned
Diffstat (limited to 'lib/unicode/prop/uprop_get_tc.c')
| -rw-r--r-- | lib/unicode/prop/uprop_get_tc.c | 15 | 
1 files changed, 8 insertions, 7 deletions
| diff --git a/lib/unicode/prop/uprop_get_tc.c b/lib/unicode/prop/uprop_get_tc.c index cececd8..e08096e 100644 --- a/lib/unicode/prop/uprop_get_tc.c +++ b/lib/unicode/prop/uprop_get_tc.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__}))} @@ -1457,16 +1456,18 @@ struct rview  uprop_get_tc(rune ch, struct tcctx ctx)  {  	constexpr rune COMB_DOT_ABOVE = 0x307; +	static thread_local rune hack; -	if (ch == 'i' && ctx.az_or_tr) -		return M(U'İ'); +	if (ch == 'i' && ctx.az_or_tr) { +		hack = U'İ'; +		return (struct rview){&hack, 1}; +	}  	if (ch == COMB_DOT_ABOVE && ctx.lt && ctx.after_soft_dotted) -		return M(); +		return (struct rview){nullptr, 0};  	struct rview rv = stage2[stage1[ch / 64]][ch % 64];  	if (rv.p != nullptr)  		return rv; -	/* TODO: This returns a pointer to a stack-allocated array; fix this! */ -	ch = uprop_get_stc(ch); -	return M(ch); +	hack = uprop_get_stc(ch); +	return (struct rview){&hack, 1};  } |