]> granicus.if.org Git - vim/commitdiff
patch 8.2.1507: using malloc() directly v8.2.1507
authorBram Moolenaar <Bram@vim.org>
Sat, 22 Aug 2020 13:19:18 +0000 (15:19 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 22 Aug 2020 13:19:18 +0000 (15:19 +0200)
Problem:    Using malloc() directly.
Solution:   Use ALLOC_ONE().  Remove superfluous typecast.  (Hussam al-Homsi,
            closes #6768)

src/eval.c
src/memline.c
src/version.c
src/vimrun.c

index cc044a4bd740968bd398d797f80fe4e4a7327c98..4b1e0f19bb7e33386c63f6a1aa0e403fe09a284d 100644 (file)
@@ -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
index 084a8b0fa4e573c8d4e76cf58dd57575fa13954d..1c594d453a8ad144befbf5bb4a0a9c88c0deae2a 100644 (file)
@@ -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)
            {
index 575f343eae91f39e83817a61f8824fc539289749..bb1624f6e89ee749e920980f1259eefedae8955d 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1507,
 /**/
     1506,
 /**/
index 26c4aa4c6406a1760dbcfdb218842f10061d2fd6..9a4c076d63f02138c8a0ffc4cf91e457ef56b036 100644 (file)
@@ -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(): ");