summaryrefslogtreecommitdiff
path: root/src/spell.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
commitc799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch)
tree68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/spell.c
parentb58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff)
downloadvim-git-c799fe206e61f2e2c1231bc46cbe4bb354f3da69.tar.gz
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type castsv8.1.1414
Problem: Alloc() returning "char_u *" causes a lot of type casts. Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to check the simple allocations.
Diffstat (limited to 'src/spell.c')
-rw-r--r--src/spell.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/spell.c b/src/spell.c
index 1e14fabff..206e7609a 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1899,7 +1899,7 @@ slang_alloc(char_u *lang)
{
slang_T *lp;
- lp = (slang_T *)alloc_clear(sizeof(slang_T));
+ lp = ALLOC_CLEAR_ONE(slang_T);
if (lp != NULL)
{
if (lang != NULL)
@@ -2083,7 +2083,7 @@ count_common_word(
hi = hash_lookup(&lp->sl_wordcount, p, hash);
if (HASHITEM_EMPTY(hi))
{
- wc = (wordcount_T *)alloc(sizeof(wordcount_T) + STRLEN(p));
+ wc = alloc(sizeof(wordcount_T) + STRLEN(p));
if (wc == NULL)
return;
STRCPY(wc->wc_word, p);
@@ -2883,7 +2883,7 @@ open_spellbuf(void)
{
buf_T *buf;
- buf = (buf_T *)alloc_clear(sizeof(buf_T));
+ buf = ALLOC_CLEAR_ONE(buf_T);
if (buf != NULL)
{
buf->b_spell = TRUE;
@@ -6223,7 +6223,7 @@ add_sound_suggest(
hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
if (HASHITEM_EMPTY(hi))
{
- sft = (sftword_T *)alloc(sizeof(sftword_T) + STRLEN(goodword));
+ sft = alloc(sizeof(sftword_T) + STRLEN(goodword));
if (sft != NULL)
{
sft->sft_score = score;
@@ -7820,7 +7820,7 @@ spell_edit_score(
/* We use "cnt" as an array: CNT(badword_idx, goodword_idx). */
#define CNT(a, b) cnt[(a) + (b) * (badlen + 1)]
- cnt = (int *)alloc(sizeof(int) * (badlen + 1) * (goodlen + 1));
+ cnt = ALLOC_MULT(int, (badlen + 1) * (goodlen + 1));
if (cnt == NULL)
return 0; /* out of memory */