#endif
/* First, alloc and init a new struct for it */
- co = (struct Cookie *)calloc(sizeof(struct Cookie), 1);
+ co = calloc(sizeof(struct Cookie), 1);
if(!co)
return NULL; /* bail out if we're this low on memory */
if(NULL == inc) {
/* we didn't get a struct, create one */
- c = (struct CookieInfo *)calloc(1, sizeof(struct CookieInfo));
+ c = calloc(1, sizeof(struct CookieInfo));
if(!c)
return NULL; /* failed to get memory */
c->filename = strdup(file?file:"none"); /* copy the name just in case */
bool fail = TRUE;
struct SessionHandle *data=(struct SessionHandle *)incurl;
- struct SessionHandle *outcurl = (struct SessionHandle *)
- calloc(sizeof(struct SessionHandle), 1);
+ struct SessionHandle *outcurl = calloc(sizeof(struct SessionHandle), 1);
if(NULL == outcurl)
return NULL; /* failure */
Curl_reset_reqproto(conn);
if(!data->state.proto.file) {
- file = (struct FILEPROTO *)calloc(sizeof(struct FILEPROTO), 1);
+ file = calloc(sizeof(struct FILEPROTO), 1);
if(!file) {
free(real_path);
return CURLE_OUT_OF_MEMORY;
struct curl_httppost **last_post)
{
struct curl_httppost *post;
- post = (struct curl_httppost *)calloc(sizeof(struct curl_httppost), 1);
+ post = calloc(sizeof(struct curl_httppost), 1);
if(post) {
post->name = name;
post->namelength = (long)(name?(namelength?namelength:strlen(name)):0);
/*
* We need to allocate the first struct to fill in.
*/
- first_form = (FormInfo *)calloc(sizeof(struct FormInfo), 1);
+ first_form = calloc(sizeof(struct FormInfo), 1);
if(!first_form)
return CURL_FORMADD_MEMORY;
struct SessionHandle *data = conn->data;
struct FTP *ftp = data->state.proto.ftp;
if(!ftp) {
- ftp = (struct FTP *)calloc(sizeof(struct FTP), 1);
+ ftp = calloc(sizeof(struct FTP), 1);
if(!ftp)
return CURLE_OUT_OF_MEMORY;
}
slash_pos=strrchr(cur_pos, '/');
if(slash_pos || !*cur_pos) {
- ftpc->dirs = (char **)calloc(1, sizeof(ftpc->dirs[0]));
+ ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
if(!ftpc->dirs)
return CURLE_OUT_OF_MEMORY;
case FTPFILE_MULTICWD:
ftpc->dirdepth = 0;
ftpc->diralloc = 5; /* default dir depth to allocate */
- ftpc->dirs = (char **)calloc(ftpc->diralloc, sizeof(ftpc->dirs[0]));
+ ftpc->dirs = calloc(ftpc->diralloc, sizeof(ftpc->dirs[0]));
if(!ftpc->dirs)
return CURLE_OUT_OF_MEMORY;
entry_len = strlen(entry_id);
/* Create a new cache entry */
- dns = (struct Curl_dns_entry *) calloc(sizeof(struct Curl_dns_entry), 1);
+ dns = calloc(sizeof(struct Curl_dns_entry), 1);
if(!dns) {
free(entry_id);
return NULL;
else {
int h_errnop;
- buf = (struct hostent *)calloc(CURL_HOSTENT_SIZE, 1);
+ buf = calloc(CURL_HOSTENT_SIZE, 1);
if(!buf)
return NULL; /* major failure */
/*
if(!data->state.proto.http) {
/* Only allocate this struct if we don't already have it! */
- http = (struct HTTP *)calloc(sizeof(struct HTTP), 1);
+ http = calloc(sizeof(struct HTTP), 1);
if(!http)
return CURLE_OUT_OF_MEMORY;
data->state.proto.http = http;
CURLM *curl_multi_init(void)
{
- struct Curl_multi *multi = (void *)calloc(sizeof(struct Curl_multi), 1);
+ struct Curl_multi *multi = calloc(sizeof(struct Curl_multi), 1);
if(!multi)
return NULL;
return CURLM_BAD_EASY_HANDLE;
/* Now, time to add an easy handle to the multi stack */
- easy = (struct Curl_one_easy *)calloc(sizeof(struct Curl_one_easy), 1);
+ easy = calloc(sizeof(struct Curl_one_easy), 1);
if(!easy)
return CURLM_OUT_OF_MEMORY;
struct SessionHandle *data)
{
int i;
- struct closure *cl = (struct closure *)calloc(sizeof(struct closure), 1);
+ struct closure *cl = calloc(sizeof(struct closure), 1);
struct closure *p=NULL;
struct closure *n;
if(cl) {
else {
sshc->readdir_currLen = strlen(sshc->readdir_longentry);
sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
- sshc->readdir_line = (char *)calloc(sshc->readdir_totalLen, 1);
+ sshc->readdir_line = calloc(sshc->readdir_totalLen, 1);
if(!sshc->readdir_line) {
Curl_safefree(sshc->readdir_filename);
sshc->readdir_filename = NULL;
if(data->state.proto.ssh)
return CURLE_OK;
- ssh = (struct SSHPROTO *)calloc(sizeof(struct SSHPROTO), 1);
+ ssh = calloc(sizeof(struct SSHPROTO), 1);
if(!ssh)
return CURLE_OUT_OF_MEMORY;
/* this is just a precaution to prevent multiple inits */
return CURLE_OK;
- session = (struct curl_ssl_session *)
- calloc(sizeof(struct curl_ssl_session), amount);
+ session = calloc(sizeof(struct curl_ssl_session), amount);
if(!session)
return CURLE_OUT_OF_MEMORY;
{
struct TELNET *tn;
- tn = (struct TELNET *)calloc(1, sizeof(struct TELNET));
+ tn = calloc(1, sizeof(struct TELNET));
if(!tn)
return CURLE_OUT_OF_MEMORY;
#endif
/* Very simple start-up: alloc the struct, init it with zeroes and return */
- data = (struct SessionHandle *)calloc(1, sizeof(struct SessionHandle));
+ data = calloc(1, sizeof(struct SessionHandle));
if(!data) {
/* this is a very serious error */
DEBUGF(fprintf(stderr, "Error: calloc of SessionHandle failed\n"));
{
struct connectdata *conn;
- conn = (struct connectdata *)calloc(1, sizeof(struct connectdata));
+ conn = calloc(1, sizeof(struct connectdata));
if(!conn)
return NULL;
/* Allocate buffer descriptors for the current thread. */
- if (!(bufs = (buffer_t *) calloc((size_t) LK_LAST, sizeof *bufs)))
+ if (!(bufs = calloc((size_t) LK_LAST, sizeof *bufs)))
return (char *) NULL;
if (pthread_setspecific(thdkey, (void *) bufs)) {
if (Curl_thread_buffer == buffer_undef) { /* If unchanged during lock. */
if (!pthread_key_create(&thdkey, thdbufdestroy))
Curl_thread_buffer = buffer_threaded;
- else if (!(locbufs = (buffer_t *) calloc((size_t) LK_LAST,
+ else if (!(locbufs = calloc((size_t) LK_LAST,
sizeof *locbufs))) {
pthread_mutex_unlock(&mutex);
return (char *) NULL;
for (i = 0; attrs[i++];)
;
- if (!(eattrs = (char * *) calloc(i, sizeof *eattrs)))
+ if (!(eattrs = calloc(i, sizeof *eattrs)))
status = LDAP_NO_MEMORY;
else {
for (j = 0; attrs[j]; j++) {
if(NULL == glob_buffer)
return CURLE_OUT_OF_MEMORY;
- glob_expand = (URLGlob*)calloc(sizeof(URLGlob), 1);
+ glob_expand = calloc(sizeof(URLGlob), 1);
if(NULL == glob_expand) {
free(glob_buffer);
return CURLE_OUT_OF_MEMORY;