1
0
forked from aniani/vim

patch 8.2.1507: using malloc() directly

Problem:    Using malloc() directly.
Solution:   Use ALLOC_ONE().  Remove superfluous typecast.  (Hussam al-Homsi,
            closes #6768)
This commit is contained in:
Bram Moolenaar
2020-08-22 15:19:18 +02:00
parent d70840ed68
commit 51b6eb47b3
4 changed files with 8 additions and 6 deletions

View File

@@ -4352,7 +4352,8 @@ set_ref_in_item(
} }
else else
{ {
ht_stack_T *newitem = (ht_stack_T*)malloc(sizeof(ht_stack_T)); ht_stack_T *newitem = ALLOC_ONE(ht_stack_T);
if (newitem == NULL) if (newitem == NULL)
abort = TRUE; abort = TRUE;
else else
@@ -4378,8 +4379,8 @@ set_ref_in_item(
} }
else else
{ {
list_stack_T *newitem = (list_stack_T*)malloc( list_stack_T *newitem = ALLOC_ONE(list_stack_T);
sizeof(list_stack_T));
if (newitem == NULL) if (newitem == NULL)
abort = TRUE; abort = TRUE;
else else

View File

@@ -5448,8 +5448,7 @@ ml_updatechunk(
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize; chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;
buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2; buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
buf->b_ml.ml_chunksize = (chunksize_T *) buf->b_ml.ml_chunksize = vim_realloc(buf->b_ml.ml_chunksize,
vim_realloc(buf->b_ml.ml_chunksize,
sizeof(chunksize_T) * buf->b_ml.ml_numchunks); sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL) if (buf->b_ml.ml_chunksize == NULL)
{ {

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1507,
/**/ /**/
1506, 1506,
/**/ /**/

View File

@@ -77,7 +77,7 @@ main(void)
if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"') if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"')
{ {
cmdlen += 3; cmdlen += 3;
cmd = (wchar_t *)malloc(cmdlen * sizeof(wchar_t)); cmd = malloc(cmdlen * sizeof(wchar_t));
if (cmd == NULL) if (cmd == NULL)
{ {
perror("vimrun malloc(): "); perror("vimrun malloc(): ");