summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
commitc799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch)
tree68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/channel.c
parentb58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff)
downloadvim-git-c799fe206e61f2e2c1231bc46cbe4bb354f3da69.tar.gz
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type castsv8.1.1414
Problem: Alloc() returning "char_u *" causes a lot of type casts. Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to check the simple allocations.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/channel.c b/src/channel.c
index f6fa13b76..558e36d33 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -294,7 +294,7 @@ static int next_ch_id = 0;
add_channel(void)
{
ch_part_T part;
- channel_T *channel = (channel_T *)alloc_clear(sizeof(channel_T));
+ channel_T *channel = ALLOC_CLEAR_ONE(channel_T);
if (channel == NULL)
return NULL;
@@ -1354,7 +1354,7 @@ channel_set_req_callback(
int id)
{
cbq_T *head = &channel->ch_part[part].ch_cb_head;
- cbq_T *item = (cbq_T *)alloc(sizeof(cbq_T));
+ cbq_T *item = ALLOC_ONE(cbq_T);
if (item != NULL)
{
@@ -1875,7 +1875,7 @@ channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len,
char_u *p;
int i;
- node = (readq_T *)alloc(sizeof(readq_T));
+ node = ALLOC_ONE(readq_T);
if (node == NULL)
return FAIL; /* out of memory */
/* A NUL is added at the end, because netbeans code expects that.
@@ -2024,7 +2024,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
}
else
{
- item = (jsonq_T *)alloc(sizeof(jsonq_T));
+ item = ALLOC_ONE(jsonq_T);
if (item == NULL)
clear_tv(&listtv);
else
@@ -2223,7 +2223,7 @@ channel_push_json(channel_T *channel, ch_part_T part, typval_T *rettv)
/* append after the last item that was pushed back */
item = item->jq_next;
- newitem = (jsonq_T *)alloc(sizeof(jsonq_T));
+ newitem = ALLOC_ONE(jsonq_T);
if (newitem == NULL)
clear_tv(rettv);
else
@@ -3921,7 +3921,7 @@ channel_send(
}
else
{
- writeq_T *last = (writeq_T *)alloc(sizeof(writeq_T));
+ writeq_T *last = ALLOC_ONE(writeq_T);
if (last != NULL)
{
@@ -5593,7 +5593,7 @@ job_alloc(void)
{
job_T *job;
- job = (job_T *)alloc_clear(sizeof(job_T));
+ job = ALLOC_CLEAR_ONE(job_T);
if (job != NULL)
{
job->jv_refcount = 1;
@@ -5822,7 +5822,7 @@ job_start(
/* Make a copy of argv_arg for job->jv_argv. */
for (i = 0; argv_arg[i] != NULL; i++)
argc++;
- argv = (char **)alloc(sizeof(char *) * (argc + 1));
+ argv = ALLOC_MULT(char *, argc + 1);
if (argv == NULL)
goto theend;
for (i = 0; i < argc; i++)