Commit a622fd90 authored by Yang Tse's avatar Yang Tse
Browse files

remove unnecessary typecasting of calloc()

parent 861b647e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 */
+1 −2
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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;

+3 −3
Original line number Diff line number Diff line
@@ -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;

Loading