Mercurial > vim
comparison src/vimrun.c @ 21915:2559dc02bd64 v8.2.1507
patch 8.2.1507: using malloc() directly
Commit: https://github.com/vim/vim/commit/51b6eb47b3c41b01a5559b099e65354c8897093e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 22 15:19:18 2020 +0200
patch 8.2.1507: using malloc() directly
Problem: Using malloc() directly.
Solution: Use ALLOC_ONE(). Remove superfluous typecast. (Hussam al-Homsi,
closes #6768)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 Aug 2020 15:30:04 +0200 |
parents | 85160a3649b9 |
children |
comparison
equal
deleted
inserted
replaced
21914:9a034db1bae7 | 21915:2559dc02bd64 |
---|---|
75 cmd = NULL; | 75 cmd = NULL; |
76 cmdlen = wcslen(p); | 76 cmdlen = wcslen(p); |
77 if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"') | 77 if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"') |
78 { | 78 { |
79 cmdlen += 3; | 79 cmdlen += 3; |
80 cmd = (wchar_t *)malloc(cmdlen * sizeof(wchar_t)); | 80 cmd = malloc(cmdlen * sizeof(wchar_t)); |
81 if (cmd == NULL) | 81 if (cmd == NULL) |
82 { | 82 { |
83 perror("vimrun malloc(): "); | 83 perror("vimrun malloc(): "); |
84 return -1; | 84 return -1; |
85 } | 85 } |