Commit 6762fe08 by Philip Kelley

Remove casts of return values of type void *

parent ac22d08f
......@@ -34,7 +34,7 @@ int git_cred_userpass_plaintext_new(
if (!cred)
return -1;
c = (git_cred_userpass_plaintext *)git__malloc(sizeof(git_cred_userpass_plaintext));
c = git__malloc(sizeof(git_cred_userpass_plaintext));
GITERR_CHECK_ALLOC(c);
c->parent.credtype = GIT_CREDTYPE_USERPASS_PLAINTEXT;
......
......@@ -154,7 +154,7 @@ static int git_stream_alloc(
if (!stream)
return -1;
s = (git_stream *)git__calloc(sizeof(git_stream), 1);
s = git__calloc(sizeof(git_stream), 1);
GITERR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
......@@ -335,7 +335,7 @@ int git_smart_subtransport_git(git_smart_subtransport **out, git_transport *owne
if (!out)
return -1;
t = (git_subtransport *)git__calloc(sizeof(git_subtransport), 1);
t = git__calloc(sizeof(git_subtransport), 1);
GITERR_CHECK_ALLOC(t);
t->owner = owner;
......
......@@ -545,7 +545,7 @@ static int http_stream_write_chunked(
int count = MIN(CHUNK_SIZE - s->chunk_buffer_len, len);
if (!s->chunk_buffer)
s->chunk_buffer = (char *)git__malloc(CHUNK_SIZE);
s->chunk_buffer = git__malloc(CHUNK_SIZE);
memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
s->chunk_buffer_len += count;
......@@ -626,7 +626,7 @@ static int http_stream_alloc(http_subtransport *t,
if (!stream)
return -1;
s = (http_stream *)git__calloc(sizeof(http_stream), 1);
s = git__calloc(sizeof(http_stream), 1);
GITERR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
......@@ -838,7 +838,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
if (!out)
return -1;
t = (http_subtransport *)git__calloc(sizeof(http_subtransport), 1);
t = git__calloc(sizeof(http_subtransport), 1);
GITERR_CHECK_ALLOC(t);
t->owner = (transport_smart *)owner;
......
......@@ -43,7 +43,7 @@ static int add_ref(transport_local *t, const char *name)
git_object *obj = NULL, *target = NULL;
git_buf buf = GIT_BUF_INIT;
head = (git_remote_head *)git__calloc(1, sizeof(git_remote_head));
head = git__calloc(1, sizeof(git_remote_head));
GITERR_CHECK_ALLOC(head);
head->name = git__strdup(name);
......@@ -78,7 +78,7 @@ static int add_ref(transport_local *t, const char *name)
}
/* And if it's a tag, peel it, and add it to the list */
head = (git_remote_head *)git__calloc(1, sizeof(git_remote_head));
head = git__calloc(1, sizeof(git_remote_head));
GITERR_CHECK_ALLOC(head);
if (git_buf_join(&buf, 0, name, peeled) < 0)
return -1;
......
......@@ -300,7 +300,7 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
if (!param)
return -1;
t = (transport_smart *)git__calloc(sizeof(transport_smart), 1);
t = git__calloc(sizeof(transport_smart), 1);
GITERR_CHECK_ALLOC(t);
t->parent.set_callbacks = git_smart__set_callbacks;
......
......@@ -30,7 +30,7 @@ static int flush_pkt(git_pkt **out)
{
git_pkt *pkt;
pkt = (git_pkt *) git__malloc(sizeof(git_pkt));
pkt = git__malloc(sizeof(git_pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_FLUSH;
......@@ -46,7 +46,7 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
GIT_UNUSED(line);
GIT_UNUSED(len);
pkt = (git_pkt_ack *) git__calloc(1, sizeof(git_pkt_ack));
pkt = git__calloc(1, sizeof(git_pkt_ack));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_ACK;
......@@ -73,7 +73,7 @@ static int nak_pkt(git_pkt **out)
{
git_pkt *pkt;
pkt = (git_pkt *) git__malloc(sizeof(git_pkt));
pkt = git__malloc(sizeof(git_pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_NAK;
......@@ -86,7 +86,7 @@ static int pack_pkt(git_pkt **out)
{
git_pkt *pkt;
pkt = (git_pkt *) git__malloc(sizeof(git_pkt));
pkt = git__malloc(sizeof(git_pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_PACK;
......@@ -99,7 +99,7 @@ static int comment_pkt(git_pkt **out, const char *line, size_t len)
{
git_pkt_comment *pkt;
pkt = (git_pkt_comment *) git__malloc(sizeof(git_pkt_comment) + len + 1);
pkt = git__malloc(sizeof(git_pkt_comment) + len + 1);
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_COMMENT;
......@@ -118,7 +118,7 @@ static int err_pkt(git_pkt **out, const char *line, size_t len)
/* Remove "ERR " from the line */
line += 4;
len -= 4;
pkt = (git_pkt_err *) git__malloc(sizeof(git_pkt_err) + len + 1);
pkt = git__malloc(sizeof(git_pkt_err) + len + 1);
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_ERR;
......@@ -136,7 +136,7 @@ static int data_pkt(git_pkt **out, const char *line, size_t len)
line++;
len--;
pkt = (git_pkt_data *) git__malloc(sizeof(git_pkt_data) + len);
pkt = git__malloc(sizeof(git_pkt_data) + len);
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_DATA;
......@@ -154,7 +154,7 @@ static int progress_pkt(git_pkt **out, const char *line, size_t len)
line++;
len--;
pkt = (git_pkt_progress *) git__malloc(sizeof(git_pkt_progress) + len);
pkt = git__malloc(sizeof(git_pkt_progress) + len);
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_PROGRESS;
......@@ -174,7 +174,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
int error;
git_pkt_ref *pkt;
pkt = (git_pkt_ref *) git__malloc(sizeof(git_pkt_ref));
pkt = git__malloc(sizeof(git_pkt_ref));
GITERR_CHECK_ALLOC(pkt);
memset(pkt, 0x0, sizeof(git_pkt_ref));
......@@ -196,7 +196,7 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
if (line[len - 1] == '\n')
--len;
pkt->head.name = (char *) git__malloc(len + 1);
pkt->head.name = git__malloc(len + 1);
GITERR_CHECK_ALLOC(pkt->head.name);
memcpy(pkt->head.name, line, len);
......@@ -219,7 +219,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_ok *pkt;
const char *ptr;
pkt = (git_pkt_ok *) git__malloc(sizeof(*pkt));
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_OK;
......@@ -228,7 +228,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
ptr = strchr(line, '\n');
len = ptr - line;
pkt->ref = (char *) git__malloc(len + 1);
pkt->ref = git__malloc(len + 1);
GITERR_CHECK_ALLOC(pkt->ref);
memcpy(pkt->ref, line, len);
......@@ -243,7 +243,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
git_pkt_ng *pkt;
const char *ptr;
pkt = (git_pkt_ng *) git__malloc(sizeof(*pkt));
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_NG;
......@@ -252,7 +252,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
ptr = strchr(line, ' ');
len = ptr - line;
pkt->ref = (char *) git__malloc(len + 1);
pkt->ref = git__malloc(len + 1);
GITERR_CHECK_ALLOC(pkt->ref);
memcpy(pkt->ref, line, len);
......@@ -262,7 +262,7 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
ptr = strchr(line, '\n');
len = ptr - line;
pkt->msg = (char *) git__malloc(len + 1);
pkt->msg = git__malloc(len + 1);
GITERR_CHECK_ALLOC(pkt->msg);
memcpy(pkt->msg, line, len);
......@@ -278,7 +278,7 @@ static int unpack_pkt(git_pkt **out, const char *line, size_t len)
GIT_UNUSED(len);
pkt = (git_pkt_unpack *) git__malloc(sizeof(*pkt));
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_UNPACK;
......
......@@ -597,7 +597,7 @@ static int parse_report(gitno_buffer *buf, git_push *push)
gitno_consume(buf, line_end);
if (pkt->type == GIT_PKT_OK) {
push_status *status = (push_status *) git__malloc(sizeof(push_status));
push_status *status = git__malloc(sizeof(push_status));
GITERR_CHECK_ALLOC(status);
status->ref = git__strdup(((git_pkt_ok *)pkt)->ref);
status->msg = NULL;
......@@ -610,7 +610,7 @@ static int parse_report(gitno_buffer *buf, git_push *push)
}
if (pkt->type == GIT_PKT_NG) {
push_status *status = (push_status *) git__malloc(sizeof(push_status));
push_status *status = git__malloc(sizeof(push_status));
GITERR_CHECK_ALLOC(status);
status->ref = git__strdup(((git_pkt_ng *)pkt)->ref);
status->msg = git__strdup(((git_pkt_ng *)pkt)->msg);
......
......@@ -104,7 +104,7 @@ static int apply_basic_credential(HINTERNET request, git_cred *cred)
goto on_error;
}
wide = (wchar_t *)git__malloc(wide_len * sizeof(wchar_t));
wide = git__malloc(wide_len * sizeof(wchar_t));
if (!wide)
goto on_error;
......@@ -389,7 +389,7 @@ replay:
return -1;
}
buffer = (char *)git__malloc(CACHED_POST_BODY_BUF_SIZE);
buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
while (len > 0) {
DWORD bytes_written;
......@@ -702,7 +702,7 @@ static int winhttp_stream_write_chunked(
int count = MIN(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
if (!s->chunk_buffer)
s->chunk_buffer = (char *)git__malloc(CACHED_POST_BODY_BUF_SIZE);
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
memcpy(s->chunk_buffer + s->chunk_buffer_len, buffer, count);
s->chunk_buffer_len += count;
......@@ -756,7 +756,7 @@ static int winhttp_stream_alloc(winhttp_subtransport *t, winhttp_stream **stream
if (!stream)
return -1;
s = (winhttp_stream *)git__calloc(sizeof(winhttp_stream), 1);
s = git__calloc(sizeof(winhttp_stream), 1);
GITERR_CHECK_ALLOC(s);
s->parent.subtransport = &t->parent;
......@@ -988,7 +988,7 @@ int git_smart_subtransport_http(git_smart_subtransport **out, git_transport *own
if (!out)
return -1;
t = (winhttp_subtransport *)git__calloc(sizeof(winhttp_subtransport), 1);
t = git__calloc(sizeof(winhttp_subtransport), 1);
GITERR_CHECK_ALLOC(t);
t->owner = (transport_smart *)owner;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment