diff src/spell.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 patch 8.1.1384: using "int" for alloc() often results in compiler warnings Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents b52ea9c5f1db
children 695d9ef00b03
line wrap: on
line diff
--- a/src/spell.c
+++ b/src/spell.c
@@ -2083,7 +2083,7 @@ count_common_word(
     hi = hash_lookup(&lp->sl_wordcount, p, hash);
     if (HASHITEM_EMPTY(hi))
     {
-	wc = (wordcount_T *)alloc((unsigned)(sizeof(wordcount_T) + STRLEN(p)));
+	wc = (wordcount_T *)alloc(sizeof(wordcount_T) + STRLEN(p));
 	if (wc == NULL)
 	    return;
 	STRCPY(wc->wc_word, p);
@@ -3432,8 +3432,7 @@ spell_suggest(int count)
 	}
 
 	/* Replace the word. */
-	p = alloc((unsigned)STRLEN(line) - stp->st_orglen
-						       + stp->st_wordlen + 1);
+	p = alloc(STRLEN(line) - stp->st_orglen + stp->st_wordlen + 1);
 	if (p != NULL)
 	{
 	    c = (int)(sug.su_badptr - line);
@@ -3552,7 +3551,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
     }
     addlen = (int)(STRLEN(repl_to) - STRLEN(repl_from));
 
-    frompat = alloc((unsigned)STRLEN(repl_from) + 7);
+    frompat = alloc(STRLEN(repl_from) + 7);
     if (frompat == NULL)
 	return;
     sprintf((char *)frompat, "\\V\\<%s\\>", repl_from);
@@ -3573,7 +3572,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
 	if (addlen <= 0 || STRNCMP(line + curwin->w_cursor.col,
 					       repl_to, STRLEN(repl_to)) != 0)
 	{
-	    p = alloc((unsigned)STRLEN(line) + addlen + 1);
+	    p = alloc(STRLEN(line) + addlen + 1);
 	    if (p == NULL)
 		break;
 	    mch_memmove(p, line, curwin->w_cursor.col);
@@ -6224,8 +6223,7 @@ add_sound_suggest(
     hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
     if (HASHITEM_EMPTY(hi))
     {
-	sft = (sftword_T *)alloc((unsigned)(sizeof(sftword_T)
-							 + STRLEN(goodword)));
+	sft = (sftword_T *)alloc(sizeof(sftword_T) + STRLEN(goodword));
 	if (sft != NULL)
 	{
 	    sft->sft_score = score;