patch 9.0.1271: using sizeof() and subtract array size is tricky
Problem: Using sizeof() and subtract array size is tricky.
Solution: Use offsetof() instead. (closes #11926)
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index 5cb576f..6b34ec8 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -3228,7 +3228,7 @@
hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
if (HASHITEM_EMPTY(hi))
{
- sft = alloc(sizeof(sftword_T) + STRLEN(goodword));
+ sft = alloc(offsetof(sftword_T, sft_word) + STRLEN(goodword) + 1);
if (sft != NULL)
{
sft->sft_score = score;