diff options
author | Yang Tse <yangsita@gmail.com> | 2008-09-06 05:29:05 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-09-06 05:29:05 +0000 |
commit | 59e378f48fed849e8e41f0bc6a10bf7a1732ae8a (patch) | |
tree | 2443ceace655d5d830c7c4d7c95869c6a0f93c5c /src | |
parent | a622fd90b4c563a4fced20c5b88cb57537e809b0 (diff) |
remove unnecessary typecasting of malloc()
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 15 | ||||
-rw-r--r-- | src/urlglob.c | 3 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c index 81f1dfd9c..e29d78212 100644 --- a/src/main.c +++ b/src/main.c @@ -932,7 +932,7 @@ AddMultiFiles (const char *file_name, struct multi_files *multi; struct multi_files *multi_type = NULL; struct multi_files *multi_name = NULL; - multi = (struct multi_files *)malloc(sizeof(struct multi_files)); + multi = malloc(sizeof(struct multi_files)); if (multi) { memset(multi, 0, sizeof(struct multi_files)); multi->form.option = CURLFORM_FILE; @@ -945,7 +945,7 @@ AddMultiFiles (const char *file_name, *multi_start = multi; if (type_name) { - multi_type = (struct multi_files *)malloc(sizeof(struct multi_files)); + multi_type = malloc(sizeof(struct multi_files)); if (multi_type) { memset(multi_type, 0, sizeof(struct multi_files)); multi_type->form.option = CURLFORM_CONTENTTYPE; @@ -960,7 +960,7 @@ AddMultiFiles (const char *file_name, } } if (show_filename) { - multi_name = (struct multi_files *)malloc(sizeof(struct multi_files)); + multi_name = malloc(sizeof(struct multi_files)); if (multi_name) { memset(multi_name, 0, sizeof(struct multi_files)); multi_name->form.option = CURLFORM_FILENAME; @@ -1192,8 +1192,7 @@ static int formparse(struct Configurable *config, ptr = ptr->next; ++count; } - forms = - (struct curl_forms *)malloc((count+1)*sizeof(struct curl_forms)); + forms = malloc((count+1)*sizeof(struct curl_forms)); if (!forms) { fprintf(config->errors, "Error building form post!\n"); @@ -3726,7 +3725,7 @@ static void FindWin32CACert(struct Configurable *config, if(curlinfo->features & CURL_VERSION_SSL) { DWORD buflen; char *ptr = NULL; - char *retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1)); + char *retval = malloc(sizeof (TCHAR) * (MAX_PATH + 1)); if (!retval) return; retval[0] = '\0'; @@ -4370,7 +4369,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) filep = curl_easy_escape(curl, filep, 0 /* use strlen */); if(filep) { - char *urlbuffer=(char *)malloc(strlen(url) + strlen(filep) + 3); + char *urlbuffer = malloc(strlen(url) + strlen(filep) + 3); if(!urlbuffer) { helpf(config->errors, "out of memory\n"); return CURLE_OUT_OF_MEMORY; @@ -4471,7 +4470,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) /* * Then append ? followed by the get fields to the url. */ - urlbuffer=(char *)malloc(strlen(url) + strlen(httpgetfields) + 3); + urlbuffer = malloc(strlen(url) + strlen(httpgetfields) + 3); if(!urlbuffer) { helpf(config->errors, "out of memory\n"); return CURLE_OUT_OF_MEMORY; diff --git a/src/urlglob.c b/src/urlglob.c index f1223f793..711a7e9f5 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -70,6 +70,7 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, pat->type = UPTSet; pat->content.Set.size = 0; pat->content.Set.ptr_s = 0; + /* FIXME: Here's a nasty zero size malloc */ pat->content.Set.elements = (char**)malloc(0); ++glob->size; @@ -335,7 +336,7 @@ int glob_url(URLGlob** glob, char* url, int *urlnum, FILE *error) */ URLGlob *glob_expand; int amount; - char *glob_buffer=(char *)malloc(strlen(url)+1); + char *glob_buffer = malloc(strlen(url)+1); *glob = NULL; if(NULL == glob_buffer) |