Changeset 3480:caab53a59052

Show
Ignore:
Timestamp:
2003-09-19 06:03:25 (5 years ago)
Author:
Mads Martin Joergensen <mmj@…>
Branch:
HEAD
Message:

As the ones of you who compile with new gcc's probably have noticed,
there's a lot of type-punning in Mutt. With help from Philipp
Thomas, I've fixed all I could find in CVS (please double-check, one
might have slipped through the cracks), I can make one for 1.4 CVS
branch as well if wanted.

Files:
31 modified

Legend:

Unmodified
Added
Removed
  • addrbook.c

    r3317 r3480  
    165165  } 
    166166 
    167   safe_realloc ((void **) &AliasTable, menu->max * sizeof (ALIAS *)); 
     167  safe_realloc (&AliasTable, menu->max * sizeof (ALIAS *)); 
    168168  menu->data = AliasTable; 
    169169 
  • browser.c

    r3375 r3480  
    308308  { 
    309309    /* need to allocate more space */ 
    310     safe_realloc ((void **) &state->entry, 
     310    safe_realloc (&state->entry, 
    311311                  sizeof (struct folder_file) * (state->entrymax += 256)); 
    312312    memset (&state->entry[state->entrylen], 0, 
  • color.c

    r3377 r3480  
    738738    if (q_level >= ColorQuoteSize) 
    739739    { 
    740       safe_realloc ((void **) &ColorQuote, (ColorQuoteSize += 2) * sizeof (int)); 
     740      safe_realloc (&ColorQuote, (ColorQuoteSize += 2) * sizeof (int)); 
    741741      ColorQuote[ColorQuoteSize-2] = ColorDefs[MT_COLOR_QUOTED]; 
    742742      ColorQuote[ColorQuoteSize-1] = ColorDefs[MT_COLOR_QUOTED]; 
  • compose.c

    r3393 r3480  
    754754        if (idxlen == idxmax) 
    755755        { 
    756           safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5)); 
     756          safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5)); 
    757757          menu->data = idx; 
    758758        } 
     
    801801          if (idxlen + numfiles >= idxmax) 
    802802          { 
    803             safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles)); 
     803            safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles)); 
    804804            menu->data = idx; 
    805805          } 
     
    900900          if (idxlen + Context->tagged >= idxmax) 
    901901          { 
    902             safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged)); 
     902            safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged)); 
    903903            menu->data = idx; 
    904904          } 
     
    11691169          if (idxlen == idxmax) 
    11701170          { 
    1171             safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5)); 
     1171            safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5)); 
    11721172            menu->data = idx; 
    11731173          } 
  • copy.c

    r3447 r3480  
    151151        else  
    152152        { 
    153           safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) +  
     153          safe_realloc (&headers[x], mutt_strlen (headers[x]) +  
    154154                        mutt_strlen (this_one) + sizeof (char)); 
    155155          strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ 
     
    218218      else 
    219219      { 
    220         safe_realloc ((void **) &this_one,  
     220        safe_realloc (&this_one, 
    221221                      mutt_strlen (this_one) + mutt_strlen (buf) + sizeof (char)); 
    222222        strcat (this_one, buf); /* __STRCAT_CHECKED__ */ 
     
    238238    else  
    239239    { 
    240       safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) +  
     240      safe_realloc (&headers[x], mutt_strlen (headers[x]) +  
    241241                    mutt_strlen (this_one) + sizeof (char)); 
    242242      strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ 
     
    796796   
    797797   
    798   safe_realloc ((void **) h, buflen); 
     798  safe_realloc (h, buflen); 
    799799  for (count = 0; a; a = a->next, count++) 
    800800  { 
     
    828828     
    829829    buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf); 
    830     safe_realloc ((void **) h, buflen); 
     830    safe_realloc (h, buflen); 
    831831    strcat (*h, cbuf);          /* __STRCAT_CHECKED__ */ 
    832832    strcat (*h, buf);           /* __STRCAT_CHECKED__ */ 
  • crypt.c

    r3407 r3480  
    767767    { 
    768768      if((*n % 5) == 0) 
    769         safe_realloc ((void **) signatures, (*n + 6) * sizeof (BODY **)); 
     769        safe_realloc (signatures, (*n + 6) * sizeof (BODY **)); 
    770770 
    771771      (*signatures)[(*n)++] = a; 
  • curs_lib.c

    r3435 r3480  
    453453 
    454454  if (UngetCount >= UngetBufLen) 
    455     safe_realloc ((void **) &KeyEvent, (UngetBufLen += 128) * sizeof(event_t)); 
     455    safe_realloc (&KeyEvent, (UngetBufLen += 128) * sizeof(event_t)); 
    456456 
    457457  KeyEvent[UngetCount++] = tmp; 
  • edit.c

    r3311 r3480  
    7878    bytes -= mutt_strlen (p); 
    7979    if (*bufmax == *buflen) 
    80       safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25)); 
     80      safe_realloc (&buf, sizeof (char *) * (*bufmax += 25)); 
    8181    buf[(*buflen)++] = safe_strdup (tmp); 
    8282  } 
    8383  if (buf && *bufmax == *buflen) { /* Do not smash memory past buf */ 
    84     safe_realloc ((void **)&buf, sizeof (char *) * (++*bufmax)); 
     84    safe_realloc (&buf, sizeof (char *) * (++*bufmax)); 
    8585  } 
    8686  if (buf) buf[*buflen] = NULL; 
     
    161161 
    162162      if (*bufmax == *buflen) 
    163         safe_realloc ((void **) &buf, sizeof (char *) * (*bufmax += 25)); 
     163        safe_realloc ( &buf, sizeof (char *) * (*bufmax += 25)); 
    164164      buf[(*buflen)++] = safe_strdup (tmp); 
    165165 
     
    176176 
    177177      if (*bufmax == *buflen) 
    178         safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25)); 
     178        safe_realloc (&buf, sizeof (char *) * (*bufmax += 25)); 
    179179      buf[(*buflen)++] = safe_strdup ("\n"); 
    180180    } 
     
    466466      strncat (tmp, "\n", sizeof(tmp)); tmp[sizeof(tmp) - 1] = '\0'; 
    467467      if (buflen == bufmax) 
    468         safe_realloc ((void **)&buf, sizeof (char *) * (bufmax += 25)); 
     468        safe_realloc (&buf, sizeof (char *) * (bufmax += 25)); 
    469469      buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp); 
    470470    } 
  • enter.c

    r3435 r3480  
    133133    { 
    134134      wbuflen = i + 20; 
    135       safe_realloc ((void **) &wbuf, wbuflen * sizeof (*wbuf)); 
     135      safe_realloc (&wbuf, wbuflen * sizeof (*wbuf)); 
    136136    } 
    137137    wbuf[i++] = wc; 
     
    159159  { 
    160160    state->wbuflen = state->curpos + savelen; 
    161     safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t)); 
     161    safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); 
    162162  } 
    163163 
     
    474474            { 
    475475              templen = state->lastchar - i; 
    476               safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t)); 
     476              safe_realloc (&tempbuf, templen * sizeof (wchar_t)); 
    477477            } 
    478478            else 
     
    539539            { 
    540540              templen = state->lastchar; 
    541               safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t)); 
     541              safe_realloc (&tempbuf, templen * sizeof (wchar_t)); 
    542542              memcpy (tempbuf, state->wbuf, templen * sizeof (wchar_t)); 
    543543            } 
     
    672672        { 
    673673          state->wbuflen = state->lastchar + 20; 
    674           safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t)); 
     674          safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); 
    675675        } 
    676676        memmove (state->wbuf + state->curpos + 1, state->wbuf + state->curpos, (state->lastchar - state->curpos) * sizeof (wchar_t)); 
  • handler.c

    r3441 r3480  
    588588    { 
    589589      stte->line_max = stte->line_used; 
    590       safe_realloc ((void **) &stte->line, stte->line_max + 1); 
     590      safe_realloc (&stte->line, stte->line_max + 1); 
    591591    } 
    592592    strcat (stte->line, stte->buffer);  /* __STRCAT_CHECKED__ */ 
     
    607607    { 
    608608      if (stte->param_used + 1 >= stte->param_len) 
    609         safe_realloc ((void **) &stte->param, (stte->param_len += STRING)); 
     609        safe_realloc (&stte->param, (stte->param_len += STRING)); 
    610610 
    611611      stte->param[stte->param_used++] = c; 
     
    618618  { 
    619619    stte->buff_len += LONG_STRING; 
    620     safe_realloc ((void **) &stte->buffer, stte->buff_len + 1); 
     620    safe_realloc (&stte->buffer, stte->buff_len + 1); 
    621621  } 
    622622 
     
    674674  { 
    675675    stte->buff_len += LONG_STRING; 
    676     safe_realloc ((void **) &stte->buffer, stte->buff_len + 1); 
     676    safe_realloc (&stte->buffer, stte->buff_len + 1); 
    677677  } 
    678678  c = s; 
  • imap/browse.c

    r2809 r3480  
    358358  if (state->entrylen + 1 == state->entrymax) 
    359359  { 
    360     safe_realloc ((void **) &state->entry, 
     360    safe_realloc (&state->entry, 
    361361      sizeof (struct folder_file) * (state->entrymax += 256)); 
    362362    memset (state->entry + state->entrylen, 0, 
  • imap/command.c

    r3441 r3480  
    106106    if (len == cmd->blen) 
    107107    { 
    108       safe_realloc ((void**) &cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE); 
     108      safe_realloc (&cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE); 
    109109      cmd->blen = cmd->blen + IMAP_CMD_BUFSIZE; 
    110110      dprint (3, (debugfile, "imap_cmd_step: grew buffer to %u bytes\n", 
     
    130130  if ((cmd->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE)) 
    131131  { 
    132     safe_realloc ((void**) &cmd->buf, IMAP_CMD_BUFSIZE); 
     132    safe_realloc (&cmd->buf, IMAP_CMD_BUFSIZE); 
    133133    cmd->blen = IMAP_CMD_BUFSIZE; 
    134134    dprint (3, (debugfile, "imap_cmd_step: shrank buffer to %u bytes\n", cmd->blen)); 
  • lib.c

    r3441 r3480  
    8787} 
    8888 
    89 void safe_realloc (void **p, size_t siz) 
     89void safe_realloc (void *ptr, size_t siz) 
    9090{ 
    9191  void *r; 
     92  void **p = (void **)ptr; 
    9293 
    9394  if (siz == 0) 
     
    119120} 
    120121 
    121 void safe_free (void **p) 
    122 { 
     122void safe_free (void *ptr) 
     123{ 
     124  void **p = (void **)ptr; 
    123125  if (*p) 
    124126  { 
     
    161163{ 
    162164  if (!p || !*p) return; 
    163   safe_realloc ((void **) p, strlen (*p) + 1); 
     165  safe_realloc (p, strlen (*p) + 1); 
    164166} 
    165167 
     
    493495        offset = *size - 1; /* overwrite the terminating 0 */ 
    494496        *size += STRING; 
    495         safe_realloc ((void **) &s, *size); 
     497        safe_realloc (&s, *size); 
    496498      } 
    497499    } 
  • lib.h

    r3181 r3480  
    7777 
    7878 
    79 # define FREE(x) safe_free((void **)x) 
     79# define FREE(x) safe_free(x) 
    8080# define NONULL(x) x?x:"" 
    8181# define ISSPACE(c) isspace((unsigned char)c) 
     
    144144void mutt_str_adjust (char **p); 
    145145void mutt_unlink (const char *); 
    146 void safe_free (void **); 
    147 void safe_realloc (void **, size_t); 
     146void safe_free (void *); 
     147void safe_realloc (void *, size_t); 
    148148 
    149149#endif 
  • mh.c

    r3179 r3480  
    7171  { 
    7272    newmax = i + 128; 
    73     safe_realloc ((void **) &mhs->flags, 
    74                   sizeof (mhs->flags[0]) * (newmax + 1)); 
     73    safe_realloc (&mhs->flags, sizeof (mhs->flags[0]) * (newmax + 1)); 
    7574    for (j = mhs->max + 1; j <= newmax; j++) 
    7675      mhs->flags[j] = 0; 
  • mutt_idna.c

    r3375 r3480  
    158158    else 
    159159    { 
    160       safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); 
     160      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); 
    161161      sprintf (a->mailbox, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */ 
    162162    } 
     
    187187    if (mutt_idna_to_local (domain, &tmp, 0) == 0) 
    188188    { 
    189       safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); 
     189      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); 
    190190      sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ 
    191191    } 
     
    221221  } 
    222222   
    223   safe_realloc ((void **) &buff, mutt_strlen (tmp) + mutt_strlen (user) + 2); 
     223  safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2); 
    224224  sprintf (buff, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */ 
    225225  FREE (&tmp); 
  • mx.c

    r3447 r3480  
    15401540  if (ctx->hdrs) 
    15411541  { 
    1542     safe_realloc ((void **) &ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)); 
    1543     safe_realloc ((void **) &ctx->v2r, sizeof (int) * ctx->hdrmax); 
     1542    safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)); 
     1543    safe_realloc (&ctx->v2r, sizeof (int) * ctx->hdrmax); 
    15441544  } 
    15451545  else 
  • pager.c

    r3443 r3480  
    759759        { 
    760760          lineInfo[i].chunks = 0; 
    761           safe_realloc ((void **) &(lineInfo[n].syntax),  
     761          safe_realloc (&(lineInfo[n].syntax),  
    762762                        sizeof (struct syntax_t)); 
    763763        } 
     
    834834            { 
    835835              if (++(lineInfo[n].chunks) > 1) 
    836                 safe_realloc ((void **)&(lineInfo[n].syntax),  
     836                safe_realloc (&(lineInfo[n].syntax),  
    837837                              (lineInfo[n].chunks) * sizeof (struct syntax_t)); 
    838838            } 
     
    12181218  if (*last == *max) 
    12191219  { 
    1220     safe_realloc ((void **)lineInfo, sizeof (struct line_t) * (*max += LINES)); 
     1220    safe_realloc (lineInfo, sizeof (struct line_t) * (*max += LINES)); 
    12211221    for (ch = *last; ch < *max ; ch++) 
    12221222    { 
     
    12911291    { 
    12921292      if (++((*lineInfo)[n].search_cnt) > 1) 
    1293         safe_realloc ((void **) &((*lineInfo)[n].search), 
     1293        safe_realloc (&((*lineInfo)[n].search), 
    12941294                      ((*lineInfo)[n].search_cnt) * sizeof (struct syntax_t)); 
    12951295      else 
     
    17901790          lineInfo[i].quote = NULL; 
    17911791 
    1792           safe_realloc ((void **)&(lineInfo[i].syntax), 
     1792          safe_realloc (&(lineInfo[i].syntax), 
    17931793                        sizeof (struct syntax_t)); 
    17941794          if (SearchCompiled && lineInfo[i].search) 
     
    22912291            lineInfo[i].quote = NULL; 
    22922292 
    2293             safe_realloc ((void **)&(lineInfo[i].syntax), sizeof (struct syntax_t)); 
     2293            safe_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); 
    22942294            if (SearchCompiled && lineInfo[i].search) 
    22952295                FREE (&(lineInfo[i].search)); 
  • parse.c

    r3344 r3480  
    7878      /* grow the buffer */ 
    7979      *linelen += STRING; 
    80       safe_realloc ((void **) &line, *linelen); 
     80      safe_realloc (&line, *linelen); 
    8181      buf = line + offset; 
    8282    } 
  • pgp.c

    r3411 r3480  
    11071107  bypass_selection: 
    11081108    keylist_size += mutt_strlen (keyID) + 4; 
    1109     safe_realloc ((void **)&keylist, keylist_size); 
     1109    safe_realloc (&keylist, keylist_size); 
    11101110    sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */ 
    11111111             keyID); 
  • pgpkey.c

    r3267 r3480  
    475475      { 
    476476        keymax += 5; 
    477         safe_realloc ((void **) &KeyTable, sizeof (pgp_key_t) * keymax); 
     477        safe_realloc (&KeyTable, sizeof (pgp_key_t) * keymax); 
    478478      } 
    479479       
  • pop_lib.c

    r2909 r3480  
    115115  else 
    116116  { 
    117     safe_realloc ((void **) &pop_data->auth_list, 
     117    safe_realloc (&pop_data->auth_list, 
    118118            strlen (pop_data->auth_list) + strlen (line) + 2); 
    119119    strcat (pop_data->auth_list, " ");  /* __STRCAT_CHECKED__ */ 
     
    411411    } 
    412412 
    413     safe_realloc ((void **) &inbuf, lenbuf + sizeof (buf)); 
     413    safe_realloc (&inbuf, lenbuf + sizeof (buf)); 
    414414  } 
    415415 
  • query.c

    r3311 r3480  
    384384 
    385385                /* append */ 
    386                 safe_realloc ((void **)&QueryTable, menu->max * sizeof (ENTRY)); 
     386                safe_realloc (&QueryTable, menu->max * sizeof (ENTRY)); 
    387387 
    388388                menu->data = QueryTable; 
  • recvattach.c

    r3403 r3480  
    111111    if (*idxlen == *idxmax) 
    112112    { 
    113       safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5)); 
     113      safe_realloc (&idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5)); 
    114114      for (i = *idxlen; i < *idxmax; i++) 
    115115        idx[i] = NULL; 
  • remailer.c

    r3179 r3480  
    105105  { 
    106106    *slots += 5; 
    107     safe_realloc ((void **) type2_list, sizeof (REMAILER *) * (*slots)); 
     107    safe_realloc (type2_list, sizeof (REMAILER *) * (*slots)); 
    108108  } 
    109109   
     
    233233    return; 
    234234   
    235   safe_realloc ((void **) coordsp, sizeof (struct coord) * chain->cl); 
     235  safe_realloc (coordsp, sizeof (struct coord) * chain->cl); 
    236236   
    237237  coords = *coordsp; 
  • rfc1524.c

    r3179 r3480  
    293293          { 
    294294            len = mutt_strlen (test_command) + STRING; 
    295             safe_realloc ((void **) &test_command, len); 
     295            safe_realloc (&test_command, len); 
    296296            rfc1524_expand_command (a, a->filename, type, test_command, len); 
    297297            if (mutt_system (test_command)) 
  • rfc2047.c

    r3441