Skip to content

Commit 51b6eb4

Browse files
committed
patch 8.2.1507: using malloc() directly
Problem: Using malloc() directly. Solution: Use ALLOC_ONE(). Remove superfluous typecast. (Hussam al-Homsi, closes #6768)
1 parent d70840e commit 51b6eb4

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/eval.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,7 +4352,8 @@ set_ref_in_item(
43524352
}
43534353
else
43544354
{
4355-
ht_stack_T *newitem = (ht_stack_T*)malloc(sizeof(ht_stack_T));
4355+
ht_stack_T *newitem = ALLOC_ONE(ht_stack_T);
4356+
43564357
if (newitem == NULL)
43574358
abort = TRUE;
43584359
else
@@ -4378,8 +4379,8 @@ set_ref_in_item(
43784379
}
43794380
else
43804381
{
4381-
list_stack_T *newitem = (list_stack_T*)malloc(
4382-
sizeof(list_stack_T));
4382+
list_stack_T *newitem = ALLOC_ONE(list_stack_T);
4383+
43834384
if (newitem == NULL)
43844385
abort = TRUE;
43854386
else

src/memline.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5448,8 +5448,7 @@ ml_updatechunk(
54485448
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;
54495449

54505450
buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
5451-
buf->b_ml.ml_chunksize = (chunksize_T *)
5452-
vim_realloc(buf->b_ml.ml_chunksize,
5451+
buf->b_ml.ml_chunksize = vim_realloc(buf->b_ml.ml_chunksize,
54535452
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
54545453
if (buf->b_ml.ml_chunksize == NULL)
54555454
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1507,
757759
/**/
758760
1506,
759761
/**/

src/vimrun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ main(void)
7777
if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"')
7878
{
7979
cmdlen += 3;
80-
cmd = (wchar_t *)malloc(cmdlen * sizeof(wchar_t));
80+
cmd = malloc(cmdlen * sizeof(wchar_t));
8181
if (cmd == NULL)
8282
{
8383
perror("vimrun malloc(): ");

0 commit comments

Comments
 (0)