summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-22 15:19:18 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-22 15:19:18 +0200
commit51b6eb47b3c41b01a5559b099e65354c8897093e (patch)
treecb476aa6fad106ae1b859a7b136b57506b857e4f
parentd70840ed68296c1144d743e6335003c81c558c24 (diff)
patch 8.2.1507: using malloc() directlyv8.2.1507
Problem: Using malloc() directly. Solution: Use ALLOC_ONE(). Remove superfluous typecast. (Hussam al-Homsi, closes #6768)
-rw-r--r--src/eval.c7
-rw-r--r--src/memline.c3
-rw-r--r--src/version.c2
-rw-r--r--src/vimrun.c2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index cc044a4bd7..4b1e0f19bb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4352,7 +4352,8 @@ set_ref_in_item(
}
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)
abort = TRUE;
else
@@ -4378,8 +4379,8 @@ set_ref_in_item(
}
else
{
- list_stack_T *newitem = (list_stack_T*)malloc(
- sizeof(list_stack_T));
+ list_stack_T *newitem = ALLOC_ONE(list_stack_T);
+
if (newitem == NULL)
abort = TRUE;
else
diff --git a/src/memline.c b/src/memline.c
index 084a8b0fa4..1c594d453a 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -5448,8 +5448,7 @@ ml_updatechunk(
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_chunksize = (chunksize_T *)
- vim_realloc(buf->b_ml.ml_chunksize,
+ buf->b_ml.ml_chunksize = vim_realloc(buf->b_ml.ml_chunksize,
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL)
{
diff --git a/src/version.c b/src/version.c
index 575f343eae..bb1624f6e8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1507,
+/**/
1506,
/**/
1505,
diff --git a/src/vimrun.c b/src/vimrun.c
index 26c4aa4c64..9a4c076d63 100644
--- a/src/vimrun.c
+++ b/src/vimrun.c
@@ -77,7 +77,7 @@ main(void)
if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"')
{
cmdlen += 3;
- cmd = (wchar_t *)malloc(cmdlen * sizeof(wchar_t));
+ cmd = malloc(cmdlen * sizeof(wchar_t));
if (cmd == NULL)
{
perror("vimrun malloc(): ");