size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
- mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
+ mem->memory = realloc(mem->memory, mem->size + realsize + 1);
if(mem->memory) {
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
static struct curl_context *create_curl_context(curl_socket_t sockfd)
{
- struct curl_context *context;
-
- context = (struct curl_context *)malloc(sizeof(*context));
+ struct curl_context *context = malloc(sizeof(*context));
context->sockfd = sockfd;
static struct curl_context *create_curl_context(curl_socket_t sockfd,
struct datauv *uv)
{
- struct curl_context *context;
-
- context = (struct curl_context *)malloc(sizeof(*context));
+ struct curl_context *context = malloc(sizeof(*context));
context->sockfd = sockfd;
context->uv = uv;
{
(void)opaque;
/* not a typo, keep it curlx_calloc() */
- return (voidpf)curlx_calloc(items, size);
+ return curlx_calloc(items, size);
}
static void zfree_cb(voidpf opaque, voidpf ptr)
/* Create a mime handle. */
curl_mime *curl_mime_init(void *easy)
{
- curl_mime *mime;
-
- mime = (curl_mime *)curlx_malloc(sizeof(*mime));
+ curl_mime *mime = curlx_malloc(sizeof(*mime));
if(mime) {
mime->parent = NULL;
if(!mime)
return NULL;
- part = (curl_mimepart *)curlx_malloc(sizeof(*part));
+ part = curlx_malloc(sizeof(*part));
if(part) {
Curl_mime_initpart(part);
}
if(ctx->tunnel_inbuf_len < max_udp_payload) {
- unsigned char *newbuf =
- (unsigned char *)curlx_realloc(ctx->tunnel_inbuf, max_udp_payload);
+ unsigned char *newbuf = curlx_realloc(ctx->tunnel_inbuf,
+ max_udp_payload);
if(!newbuf)
return CURLE_OUT_OF_MEMORY;
ctx->tunnel_inbuf = newbuf;
if(data->set.ssl.primary.key_passwd)
pwd_len = strlen(data->set.ssl.primary.key_passwd);
- pszPassword = (WCHAR *)curlx_malloc(sizeof(WCHAR) * (pwd_len + 1));
+ pszPassword = curlx_malloc(sizeof(WCHAR) * (pwd_len + 1));
if(pszPassword) {
int str_w_len = 0;
if(pwd_len > 0)
/* calculate the complete message length and allocate a buffer for it */
data_len = backend->stream_sizes.cbHeader + len +
backend->stream_sizes.cbTrailer;
- ptr = (unsigned char *)curlx_malloc(data_len);
+ ptr = curlx_malloc(data_len);
if(!ptr) {
return CURLE_OUT_OF_MEMORY;
}
goto cleanup;
}
- ca_file_buffer = (char *)curlx_malloc(ca_file_bufsize + 1);
+ ca_file_buffer = curlx_malloc(ca_file_bufsize + 1);
if(!ca_file_buffer) {
result = CURLE_OUT_OF_MEMORY;
goto cleanup;
/* CertGetNameString guarantees that the returned name does not contain
* embedded null bytes. This appears to be undocumented behavior.
*/
- cert_hostname_buff = (LPTSTR)curlx_malloc(len * sizeof(TCHAR));
+ cert_hostname_buff = curlx_malloc(len * sizeof(TCHAR));
if(!cert_hostname_buff) {
result = CURLE_OUT_OF_MEMORY;
goto cleanup;
case CURLINFO_CERTINFO:
cipf = *(struct curl_certinfo **)paramp;
if(cipf) {
- cipt = (struct curl_certinfo *)malloc(sizeof(*cipt));
+ cipt = malloc(sizeof(*cipt));
if(!cipt)
result = CURLE_OUT_OF_MEMORY;
else {
- cipt->certinfo =
- (struct curl_slist **)calloc(cipf->num_of_certs + 1,
- sizeof(struct curl_slist *));
+ cipt->certinfo = calloc(cipf->num_of_certs + 1,
+ sizeof(struct curl_slist *));
if(!cipt->certinfo)
result = CURLE_OUT_OF_MEMORY;
else {
if(!exitcode) {
/* Allocate space for parsed arguments. */
- argv = (char **)malloc((argc + 1) * sizeof(*argv) + argsize);
+ argv = malloc((argc + 1) * sizeof(*argv) + argsize);
if(!argv) {
fputs("Memory allocation error\n", stderr);
exitcode = -2;
}
/* Allocate memory for the ASCII arguments and vector. */
- argv = (char **)malloc((argc + 1) * sizeof(*argv) + bytecount);
+ argv = malloc((argc + 1) * sizeof(*argv) + bytecount);
/* Build the vector and convert argument encoding. */
outbuf = (char *)(argv + argc + 1);
{
(void)opaque;
/* not a typo, keep it curlx_calloc() */
- return (voidpf)curlx_calloc(items, size);
+ return curlx_calloc(items, size);
}
static void zfree_func(voidpf opaque, voidpf ptr)
{
/* grow the buffer if needed */
if(len > global->term.len) {
- wchar_t *buf = (wchar_t *)curlx_realloc(global->term.buf,
- len * sizeof(wchar_t));
+ wchar_t *buf = curlx_realloc(global->term.buf, len * sizeof(wchar_t));
if(!buf)
return CURL_WRITEFUNC_ERROR;
global->term.len = len;
static struct tool_mime *tool_mime_new(struct tool_mime *parent,
toolmimekind kind)
{
- struct tool_mime *m = (struct tool_mime *)curlx_calloc(1, sizeof(*m));
+ struct tool_mime *m = curlx_calloc(1, sizeof(*m));
if(m) {
m->kind = kind;
static struct contextuv *create_context(curl_socket_t sockfd,
struct datauv *uv)
{
- struct contextuv *c;
-
- c = (struct contextuv *)curlx_malloc(sizeof(*c));
+ struct contextuv *c = curlx_malloc(sizeof(*c));
c->sockfd = sockfd;
c->uv = uv;
global_init(CURL_GLOBAL_ALL);
memset(&ws_data, 0, sizeof(ws_data));
- ws_data.buf = (char *)curlx_calloc(LIB2302_BUFSIZE, 1);
+ ws_data.buf = curlx_calloc(LIB2302_BUFSIZE, 1);
if(ws_data.buf) {
curl = curl_easy_init();
if(curl) {