diff options
author | Yang Tse <yangsita@gmail.com> | 2008-09-06 04:47:14 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-09-06 04:47:14 +0000 |
commit | a622fd90b4c563a4fced20c5b88cb57537e809b0 (patch) | |
tree | b0b3c28505d41d062f7828c0d1e13e3aa9a351a8 /lib | |
parent | 861b647e7b1da564b831a5b07312a30feb7b6c58 (diff) |
remove unnecessary typecasting of calloc()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cookie.c | 4 | ||||
-rw-r--r-- | lib/easy.c | 3 | ||||
-rw-r--r-- | lib/file.c | 2 | ||||
-rw-r--r-- | lib/formdata.c | 4 | ||||
-rw-r--r-- | lib/ftp.c | 6 | ||||
-rw-r--r-- | lib/hostip.c | 2 | ||||
-rw-r--r-- | lib/hostip4.c | 2 | ||||
-rw-r--r-- | lib/http.c | 2 | ||||
-rw-r--r-- | lib/multi.c | 6 | ||||
-rw-r--r-- | lib/ssh.c | 4 | ||||
-rw-r--r-- | lib/sslgen.c | 3 | ||||
-rw-r--r-- | lib/telnet.c | 2 | ||||
-rw-r--r-- | lib/url.c | 4 |
13 files changed, 21 insertions, 23 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index 93d088d75..fada612dd 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -190,7 +190,7 @@ Curl_cookie_add(struct SessionHandle *data, #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 */ @@ -683,7 +683,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, 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 */ diff --git a/lib/easy.c b/lib/easy.c index 741dbb217..1dba68c8f 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -600,8 +600,7 @@ CURL *curl_easy_duphandle(CURL *incurl) 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 */ diff --git a/lib/file.c b/lib/file.c index 08d26c54a..6dd63b6a2 100644 --- a/lib/file.c +++ b/lib/file.c @@ -202,7 +202,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) 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; diff --git a/lib/formdata.c b/lib/formdata.c index 54eabb2f8..2ab1d1af1 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -171,7 +171,7 @@ AddHttpPost(char *name, size_t namelength, 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); @@ -410,7 +410,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, /* * 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; @@ -3022,7 +3022,7 @@ static CURLcode ftp_init(struct connectdata *conn) 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; @@ -3905,7 +3905,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) } 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; @@ -3927,7 +3927,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) 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; diff --git a/lib/hostip.c b/lib/hostip.c index 604dbbbdc..f223889dd 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -332,7 +332,7 @@ Curl_cache_addr(struct SessionHandle *data, 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; diff --git a/lib/hostip4.c b/lib/hostip4.c index b3c358838..a7d94c87a 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -150,7 +150,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, else { int h_errnop; - buf = (struct hostent *)calloc(CURL_HOSTENT_SIZE, 1); + buf = calloc(CURL_HOSTENT_SIZE, 1); if(!buf) return NULL; /* major failure */ /* diff --git a/lib/http.c b/lib/http.c index 3b05184ad..6b22c2c10 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2063,7 +2063,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) 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; diff --git a/lib/multi.c b/lib/multi.c index f49d42699..acf43a204 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -358,7 +358,7 @@ static struct curl_hash *sh_init(void) 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; @@ -419,7 +419,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, 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; @@ -2181,7 +2181,7 @@ static void add_closure(struct Curl_multi *multi, 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) { @@ -1461,7 +1461,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn) 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; @@ -2021,7 +2021,7 @@ static CURLcode ssh_init(struct connectdata *conn) 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; diff --git a/lib/sslgen.c b/lib/sslgen.c index b78310f2f..eee46b912 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -428,8 +428,7 @@ CURLcode Curl_ssl_initsessions(struct SessionHandle *data, long amount) /* 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; diff --git a/lib/telnet.c b/lib/telnet.c index c44658914..63eef5f29 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -241,7 +241,7 @@ CURLcode init_telnet(struct connectdata *conn) { struct TELNET *tn; - tn = (struct TELNET *)calloc(1, sizeof(struct TELNET)); + tn = calloc(1, sizeof(struct TELNET)); if(!tn) return CURLE_OUT_OF_MEMORY; @@ -651,7 +651,7 @@ CURLcode Curl_open(struct SessionHandle **curl) #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")); @@ -2969,7 +2969,7 @@ static struct connectdata *allocate_conn(void) { struct connectdata *conn; - conn = (struct connectdata *)calloc(1, sizeof(struct connectdata)); + conn = calloc(1, sizeof(struct connectdata)); if(!conn) return NULL; |