From 145db1151dc7cdb0af665b466ba6afa977f0ddd1 Mon Sep 17 00:00:00 2001 From: Mads Martin Joergensen Date: Fri, 19 Sep 2003 13:03:25 +0000 Subject: [PATCH] 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. --- addrbook.c | 2 +- browser.c | 2 +- color.c | 2 +- compose.c | 8 ++++---- copy.c | 10 +++++----- crypt.c | 2 +- curs_lib.c | 2 +- edit.c | 10 +++++----- enter.c | 10 +++++----- handler.c | 8 ++++---- imap/browse.c | 2 +- imap/command.c | 4 ++-- lib.c | 10 ++++++---- lib.h | 6 +++--- mh.c | 3 +-- mutt_idna.c | 6 +++--- mx.c | 4 ++-- pager.c | 12 ++++++------ parse.c | 2 +- pgp.c | 2 +- pgpkey.c | 2 +- pop_lib.c | 4 ++-- query.c | 2 +- recvattach.c | 2 +- remailer.c | 4 ++-- rfc1524.c | 2 +- rfc2047.c | 6 +++--- rfc2231.c | 2 +- sendlib.c | 17 ++++++++--------- smime.c | 2 +- thread.c | 3 +-- 31 files changed, 76 insertions(+), 77 deletions(-) diff --git a/addrbook.c b/addrbook.c index 54a924285..08bed1765 100644 --- a/addrbook.c +++ b/addrbook.c @@ -164,7 +164,7 @@ new_aliases: menu->max++; } - safe_realloc ((void **) &AliasTable, menu->max * sizeof (ALIAS *)); + safe_realloc (&AliasTable, menu->max * sizeof (ALIAS *)); menu->data = AliasTable; for (i = omax, aliasp = aliases; aliasp; aliasp = aliasp->next, i++) diff --git a/browser.c b/browser.c index 1ee315f0e..f60295b95 100644 --- a/browser.c +++ b/browser.c @@ -307,7 +307,7 @@ static void add_folder (MUTTMENU *m, struct browser_state *state, if (state->entrylen == state->entrymax) { /* need to allocate more space */ - safe_realloc ((void **) &state->entry, + safe_realloc (&state->entry, sizeof (struct folder_file) * (state->entrymax += 256)); memset (&state->entry[state->entrylen], 0, sizeof (struct folder_file) * 256); diff --git a/color.c b/color.c index 134818a5f..2d013e734 100644 --- a/color.c +++ b/color.c @@ -737,7 +737,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, { if (q_level >= ColorQuoteSize) { - safe_realloc ((void **) &ColorQuote, (ColorQuoteSize += 2) * sizeof (int)); + safe_realloc (&ColorQuote, (ColorQuoteSize += 2) * sizeof (int)); ColorQuote[ColorQuoteSize-2] = ColorDefs[MT_COLOR_QUOTED]; ColorQuote[ColorQuoteSize-1] = ColorDefs[MT_COLOR_QUOTED]; } diff --git a/compose.c b/compose.c index 8160b2629..22ebc23c2 100644 --- a/compose.c +++ b/compose.c @@ -753,7 +753,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ break; if (idxlen == idxmax) { - safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5)); + safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5)); menu->data = idx; } @@ -800,7 +800,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (idxlen + numfiles >= idxmax) { - safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles)); + safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles)); menu->data = idx; } @@ -899,7 +899,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (idxlen + Context->tagged >= idxmax) { - safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged)); + safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged)); menu->data = idx; } @@ -1168,7 +1168,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ } if (idxlen == idxmax) { - safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5)); + safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5)); menu->data = idx; } diff --git a/copy.c b/copy.c index 3d814febe..2bfcde7fb 100644 --- a/copy.c +++ b/copy.c @@ -150,7 +150,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags, headers[x] = this_one; else { - safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) + + safe_realloc (&headers[x], mutt_strlen (headers[x]) + mutt_strlen (this_one) + sizeof (char)); strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ FREE (&this_one); @@ -217,7 +217,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags, this_one = safe_strdup (buf); else { - safe_realloc ((void **) &this_one, + safe_realloc (&this_one, mutt_strlen (this_one) + mutt_strlen (buf) + sizeof (char)); strcat (this_one, buf); /* __STRCAT_CHECKED__ */ } @@ -237,7 +237,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags, headers[x] = this_one; else { - safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) + + safe_realloc (&headers[x], mutt_strlen (headers[x]) + mutt_strlen (this_one) + sizeof (char)); strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ FREE (&this_one); @@ -795,7 +795,7 @@ static void format_address_header (char **h, ADDRESS *a) buflen = linelen + 3; - safe_realloc ((void **) h, buflen); + safe_realloc (h, buflen); for (count = 0; a; a = a->next, count++) { ADDRESS *tmp = a->next; @@ -827,7 +827,7 @@ static void format_address_header (char **h, ADDRESS *a) } buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf); - safe_realloc ((void **) h, buflen); + safe_realloc (h, buflen); strcat (*h, cbuf); /* __STRCAT_CHECKED__ */ strcat (*h, buf); /* __STRCAT_CHECKED__ */ strcat (*h, c2buf); /* __STRCAT_CHECKED__ */ diff --git a/crypt.c b/crypt.c index 72f775dd0..6bca40dd7 100644 --- a/crypt.c +++ b/crypt.c @@ -766,7 +766,7 @@ static void crypt_fetch_signatures (BODY ***signatures, BODY *a, int *n) else { if((*n % 5) == 0) - safe_realloc ((void **) signatures, (*n + 6) * sizeof (BODY **)); + safe_realloc (signatures, (*n + 6) * sizeof (BODY **)); (*signatures)[(*n)++] = a; } diff --git a/curs_lib.c b/curs_lib.c index ff97d316b..28fd0ae72 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -452,7 +452,7 @@ void mutt_ungetch (int ch, int op) tmp.op = op; if (UngetCount >= UngetBufLen) - safe_realloc ((void **) &KeyEvent, (UngetBufLen += 128) * sizeof(event_t)); + safe_realloc (&KeyEvent, (UngetBufLen += 128) * sizeof(event_t)); KeyEvent[UngetCount++] = tmp; } diff --git a/edit.c b/edit.c index 77472910d..e29cb6691 100644 --- a/edit.c +++ b/edit.c @@ -77,11 +77,11 @@ be_snarf_data (FILE *f, char **buf, int *bufmax, int *buflen, int offset, if (fgets (p, tmplen - 1, f) == NULL) break; bytes -= mutt_strlen (p); if (*bufmax == *buflen) - safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25)); + safe_realloc (&buf, sizeof (char *) * (*bufmax += 25)); buf[(*buflen)++] = safe_strdup (tmp); } if (buf && *bufmax == *buflen) { /* Do not smash memory past buf */ - safe_realloc ((void **)&buf, sizeof (char *) * (++*bufmax)); + safe_realloc (&buf, sizeof (char *) * (++*bufmax)); } if (buf) buf[*buflen] = NULL; return (buf); @@ -160,7 +160,7 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen, } if (*bufmax == *buflen) - safe_realloc ((void **) &buf, sizeof (char *) * (*bufmax += 25)); + safe_realloc ( &buf, sizeof (char *) * (*bufmax += 25)); buf[(*buflen)++] = safe_strdup (tmp); bytes = Context->hdrs[n]->content->length; @@ -175,7 +175,7 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen, pfx); if (*bufmax == *buflen) - safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25)); + safe_realloc (&buf, sizeof (char *) * (*bufmax += 25)); buf[(*buflen)++] = safe_strdup ("\n"); } else @@ -465,7 +465,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur) { strncat (tmp, "\n", sizeof(tmp)); tmp[sizeof(tmp) - 1] = '\0'; if (buflen == bufmax) - safe_realloc ((void **)&buf, sizeof (char *) * (bufmax += 25)); + safe_realloc (&buf, sizeof (char *) * (bufmax += 25)); buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp); } diff --git a/enter.c b/enter.c index bd436ba5c..9547ebb8f 100644 --- a/enter.c +++ b/enter.c @@ -132,7 +132,7 @@ size_t my_mbstowcs (wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf) if (i >= wbuflen) { wbuflen = i + 20; - safe_realloc ((void **) &wbuf, wbuflen * sizeof (*wbuf)); + safe_realloc (&wbuf, wbuflen * sizeof (*wbuf)); } wbuf[i++] = wc; } @@ -158,7 +158,7 @@ static void replace_part (ENTER_STATE *state, size_t from, char *buf) if (state->curpos + savelen > state->wbuflen) { state->wbuflen = state->curpos + savelen; - safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t)); + safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); } /* Restore suffix */ @@ -473,7 +473,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, if (!mutt_complete (buf, buflen)) { templen = state->lastchar - i; - safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t)); + safe_realloc (&tempbuf, templen * sizeof (wchar_t)); } else BEEP (); @@ -538,7 +538,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, if (!mutt_complete (buf, buflen)) { templen = state->lastchar; - safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t)); + safe_realloc (&tempbuf, templen * sizeof (wchar_t)); memcpy (tempbuf, state->wbuf, templen * sizeof (wchar_t)); } else @@ -671,7 +671,7 @@ self_insert: if (state->lastchar >= state->wbuflen) { state->wbuflen = state->lastchar + 20; - safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t)); + safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t)); } memmove (state->wbuf + state->curpos + 1, state->wbuf + state->curpos, (state->lastchar - state->curpos) * sizeof (wchar_t)); state->wbuf[state->curpos++] = wc; diff --git a/handler.c b/handler.c index 49bba437d..850405951 100644 --- a/handler.c +++ b/handler.c @@ -587,7 +587,7 @@ static void enriched_flush (struct enriched_state *stte, int wrap) if (stte->line_used > stte->line_max) { stte->line_max = stte->line_used; - safe_realloc ((void **) &stte->line, stte->line_max + 1); + safe_realloc (&stte->line, stte->line_max + 1); } strcat (stte->line, stte->buffer); /* __STRCAT_CHECKED__ */ stte->line_len += stte->word_len; @@ -606,7 +606,7 @@ static void enriched_putc (int c, struct enriched_state *stte) if (stte->tag_level[RICH_COLOR]) { if (stte->param_used + 1 >= stte->param_len) - safe_realloc ((void **) &stte->param, (stte->param_len += STRING)); + safe_realloc (&stte->param, (stte->param_len += STRING)); stte->param[stte->param_used++] = c; } @@ -617,7 +617,7 @@ static void enriched_putc (int c, struct enriched_state *stte) if (stte->buff_len < stte->buff_used + 3) { stte->buff_len += LONG_STRING; - safe_realloc ((void **) &stte->buffer, stte->buff_len + 1); + safe_realloc (&stte->buffer, stte->buff_len + 1); } if ((!stte->tag_level[RICH_NOFILL] && ISSPACE (c)) || c == '\0' ) @@ -673,7 +673,7 @@ static void enriched_puts (char *s, struct enriched_state *stte) if (stte->buff_len < stte->buff_used + mutt_strlen(s)) { stte->buff_len += LONG_STRING; - safe_realloc ((void **) &stte->buffer, stte->buff_len + 1); + safe_realloc (&stte->buffer, stte->buff_len + 1); } c = s; while (*c) diff --git a/imap/browse.c b/imap/browse.c index 430099573..4a43420ca 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -357,7 +357,7 @@ static void imap_add_folder (char delim, char *folder, int noselect, if (state->entrylen + 1 == state->entrymax) { - safe_realloc ((void **) &state->entry, + safe_realloc (&state->entry, sizeof (struct folder_file) * (state->entrymax += 256)); memset (state->entry + state->entrylen, 0, (sizeof (struct folder_file) * (state->entrymax - state->entrylen))); diff --git a/imap/command.c b/imap/command.c index 214c281c4..47cd3edfe 100644 --- a/imap/command.c +++ b/imap/command.c @@ -105,7 +105,7 @@ int imap_cmd_step (IMAP_DATA* idata) { if (len == cmd->blen) { - safe_realloc ((void**) &cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE); + safe_realloc (&cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE); cmd->blen = cmd->blen + IMAP_CMD_BUFSIZE; dprint (3, (debugfile, "imap_cmd_step: grew buffer to %u bytes\n", cmd->blen)); @@ -129,7 +129,7 @@ int imap_cmd_step (IMAP_DATA* idata) /* don't let one large string make cmd->buf hog memory forever */ if ((cmd->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE)) { - safe_realloc ((void**) &cmd->buf, IMAP_CMD_BUFSIZE); + safe_realloc (&cmd->buf, IMAP_CMD_BUFSIZE); cmd->blen = IMAP_CMD_BUFSIZE; dprint (3, (debugfile, "imap_cmd_step: shrank buffer to %u bytes\n", cmd->blen)); } diff --git a/lib.c b/lib.c index aeece74e6..97879c987 100644 --- a/lib.c +++ b/lib.c @@ -86,9 +86,10 @@ void *safe_malloc (size_t siz) return (p); } -void safe_realloc (void **p, size_t siz) +void safe_realloc (void *ptr, size_t siz) { void *r; + void **p = (void **)ptr; if (siz == 0) { @@ -118,8 +119,9 @@ void safe_realloc (void **p, size_t siz) *p = r; } -void safe_free (void **p) +void safe_free (void *ptr) { + void **p = (void **)ptr; if (*p) { free (*p); /* __MEM_CHECKED__ */ @@ -160,7 +162,7 @@ void mutt_str_replace (char **p, const char *s) void mutt_str_adjust (char **p) { if (!p || !*p) return; - safe_realloc ((void **) p, strlen (*p) + 1); + safe_realloc (p, strlen (*p) + 1); } /* convert all characters in the string to lowercase */ @@ -492,7 +494,7 @@ char *mutt_read_line (char *s, size_t *size, FILE *fp, int *line) /* There wasn't room for the line -- increase ``s'' */ offset = *size - 1; /* overwrite the terminating 0 */ *size += STRING; - safe_realloc ((void **) &s, *size); + safe_realloc (&s, *size); } } } diff --git a/lib.h b/lib.h index d38a5f784..6e0068366 100644 --- a/lib.h +++ b/lib.h @@ -76,7 +76,7 @@ # define MUTT_FORMAT2(a,b) _MUTT_FORMAT_1(a, b) -# define FREE(x) safe_free((void **)x) +# define FREE(x) safe_free(x) # define NONULL(x) x?x:"" # define ISSPACE(c) isspace((unsigned char)c) # define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0 @@ -143,7 +143,7 @@ void mutt_sanitize_filename (char *, short); void mutt_str_replace (char **p, const char *s); void mutt_str_adjust (char **p); void mutt_unlink (const char *); -void safe_free (void **); -void safe_realloc (void **, size_t); +void safe_free (void *); +void safe_realloc (void *, size_t); #endif diff --git a/mh.c b/mh.c index ab4844fda..79ef88e76 100644 --- a/mh.c +++ b/mh.c @@ -70,8 +70,7 @@ static void mhs_alloc (struct mh_sequences *mhs, int i) if (i > mhs->max || !mhs->flags) { newmax = i + 128; - safe_realloc ((void **) &mhs->flags, - sizeof (mhs->flags[0]) * (newmax + 1)); + safe_realloc (&mhs->flags, sizeof (mhs->flags[0]) * (newmax + 1)); for (j = mhs->max + 1; j <= newmax; j++) mhs->flags[j] = 0; diff --git a/mutt_idna.c b/mutt_idna.c index b6d3140ed..6c0cc24c6 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -157,7 +157,7 @@ int mutt_addrlist_to_idna (ADDRESS *a, char **err) } else { - safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); + safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */ } @@ -186,7 +186,7 @@ int mutt_addrlist_to_local (ADDRESS *a) if (mutt_idna_to_local (domain, &tmp, 0) == 0) { - safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); + safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ } @@ -220,7 +220,7 @@ const char *mutt_addr_for_display (ADDRESS *a) return a->mailbox; } - safe_realloc ((void **) &buff, mutt_strlen (tmp) + mutt_strlen (user) + 2); + safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2); sprintf (buff, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */ FREE (&tmp); FREE (&user); diff --git a/mx.c b/mx.c index 8b8c96f2e..41b2fcbfb 100644 --- a/mx.c +++ b/mx.c @@ -1539,8 +1539,8 @@ void mx_alloc_memory (CONTEXT *ctx) if (ctx->hdrs) { - safe_realloc ((void **) &ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)); - safe_realloc ((void **) &ctx->v2r, sizeof (int) * ctx->hdrmax); + safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)); + safe_realloc (&ctx->v2r, sizeof (int) * ctx->hdrmax); } else { diff --git a/pager.c b/pager.c index 731ea1013..26fcf07e3 100644 --- a/pager.c +++ b/pager.c @@ -758,7 +758,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, if (lineInfo[i].chunks) { lineInfo[i].chunks = 0; - safe_realloc ((void **) &(lineInfo[n].syntax), + safe_realloc (&(lineInfo[n].syntax), sizeof (struct syntax_t)); } lineInfo[i++].type = MT_COLOR_SIGNATURE; @@ -833,7 +833,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, if (!found) { if (++(lineInfo[n].chunks) > 1) - safe_realloc ((void **)&(lineInfo[n].syntax), + safe_realloc (&(lineInfo[n].syntax), (lineInfo[n].chunks) * sizeof (struct syntax_t)); } i = lineInfo[n].chunks - 1; @@ -1217,7 +1217,7 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n, if (*last == *max) { - safe_realloc ((void **)lineInfo, sizeof (struct line_t) * (*max += LINES)); + safe_realloc (lineInfo, sizeof (struct line_t) * (*max += LINES)); for (ch = *last; ch < *max ; ch++) { memset (&((*lineInfo)[ch]), 0, sizeof (struct line_t)); @@ -1290,7 +1290,7 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n, while (regexec (SearchRE, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) { if (++((*lineInfo)[n].search_cnt) > 1) - safe_realloc ((void **) &((*lineInfo)[n].search), + safe_realloc (&((*lineInfo)[n].search), ((*lineInfo)[n].search_cnt) * sizeof (struct syntax_t)); else (*lineInfo)[n].search = safe_malloc (sizeof (struct syntax_t)); @@ -1789,7 +1789,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) lineInfo[i].search_cnt = -1; lineInfo[i].quote = NULL; - safe_realloc ((void **)&(lineInfo[i].syntax), + safe_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) FREE (&(lineInfo[i].search)); @@ -2290,7 +2290,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); lineInfo[i].search_cnt = -1; lineInfo[i].quote = NULL; - safe_realloc ((void **)&(lineInfo[i].syntax), sizeof (struct syntax_t)); + safe_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) FREE (&(lineInfo[i].search)); } diff --git a/parse.c b/parse.c index 78e4dd732..5317edbb5 100644 --- a/parse.c +++ b/parse.c @@ -77,7 +77,7 @@ static char *read_rfc822_line (FILE *f, char *line, size_t *linelen) { /* grow the buffer */ *linelen += STRING; - safe_realloc ((void **) &line, *linelen); + safe_realloc (&line, *linelen); buf = line + offset; } } diff --git a/pgp.c b/pgp.c index 98f7e009e..9fcdd3d3f 100644 --- a/pgp.c +++ b/pgp.c @@ -1106,7 +1106,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) bypass_selection: keylist_size += mutt_strlen (keyID) + 4; - safe_realloc ((void **)&keylist, keylist_size); + safe_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */ keyID); keylist_used = mutt_strlen (keylist); diff --git a/pgpkey.c b/pgpkey.c index 800b07e1e..bb98403a3 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -474,7 +474,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, if (i == keymax) { keymax += 5; - safe_realloc ((void **) &KeyTable, sizeof (pgp_key_t) * keymax); + safe_realloc (&KeyTable, sizeof (pgp_key_t) * keymax); } KeyTable[i++] = a; diff --git a/pop_lib.c b/pop_lib.c index 65b7c9903..171976a83 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -114,7 +114,7 @@ static int fetch_auth (char *line, void *data) } else { - safe_realloc ((void **) &pop_data->auth_list, + safe_realloc (&pop_data->auth_list, strlen (pop_data->auth_list) + strlen (line) + 2); strcat (pop_data->auth_list, " "); /* __STRCAT_CHECKED__ */ } @@ -410,7 +410,7 @@ int pop_fetch_data (POP_DATA *pop_data, char *query, char *msg, lenbuf = 0; } - safe_realloc ((void **) &inbuf, lenbuf + sizeof (buf)); + safe_realloc (&inbuf, lenbuf + sizeof (buf)); } FREE (&inbuf); diff --git a/query.c b/query.c index d15a8590c..bcd648c48 100644 --- a/query.c +++ b/query.c @@ -383,7 +383,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) int clear = 0; /* append */ - safe_realloc ((void **)&QueryTable, menu->max * sizeof (ENTRY)); + safe_realloc (&QueryTable, menu->max * sizeof (ENTRY)); menu->data = QueryTable; diff --git a/recvattach.c b/recvattach.c index 5850fe64a..09abea2d8 100644 --- a/recvattach.c +++ b/recvattach.c @@ -110,7 +110,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *m, { if (*idxlen == *idxmax) { - safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5)); + safe_realloc (&idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5)); for (i = *idxlen; i < *idxmax; i++) idx[i] = NULL; } diff --git a/remailer.c b/remailer.c index e7be2ceed..8172f7c21 100644 --- a/remailer.c +++ b/remailer.c @@ -104,7 +104,7 @@ static void mix_add_entry (REMAILER ***type2_list, REMAILER *entry, if (*used == *slots) { *slots += 5; - safe_realloc ((void **) type2_list, sizeof (REMAILER *) * (*slots)); + safe_realloc (type2_list, sizeof (REMAILER *) * (*slots)); } (*type2_list)[(*used)++] = entry; @@ -232,7 +232,7 @@ static void mix_screen_coordinates (REMAILER **type2_list, if (!chain->cl) return; - safe_realloc ((void **) coordsp, sizeof (struct coord) * chain->cl); + safe_realloc (coordsp, sizeof (struct coord) * chain->cl); coords = *coordsp; diff --git a/rfc1524.c b/rfc1524.c index eddcacd0c..f0fc57b80 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -292,7 +292,7 @@ static int rfc1524_mailcap_parse (BODY *a, && test_command) { len = mutt_strlen (test_command) + STRING; - safe_realloc ((void **) &test_command, len); + safe_realloc (&test_command, len); rfc1524_expand_command (a, a->filename, type, test_command, len); if (mutt_system (test_command)) { diff --git a/rfc2047.c b/rfc2047.c index 8e2dd4997..265fd4d92 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -76,7 +76,7 @@ static size_t convert_string (ICONV_CONST char *f, size_t flen, *tlen = ob - buf; - safe_realloc ((void **) &buf, ob - buf + 1); + safe_realloc (&buf, ob - buf + 1); *t = buf; iconv_close (cd); @@ -511,7 +511,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, if (bufpos + wlen + strlen (LINEBREAK) > buflen) { buflen = bufpos + wlen + strlen (LINEBREAK); - safe_realloc ((void **) &buf, buflen); + safe_realloc (&buf, buflen); } r = encode_block (buf + bufpos, t, n, icode, tocode, encoder); assert (r == wlen); @@ -527,7 +527,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, /* Add last encoded word and us-ascii suffix to buffer. */ buflen = bufpos + wlen + (u + ulen - t1); - safe_realloc ((void **) &buf, buflen + 1); + safe_realloc (&buf, buflen + 1); r = encode_block (buf + bufpos, t, t1 - t, icode, tocode, encoder); assert (r == wlen); bufpos += wlen; diff --git a/rfc2231.c b/rfc2231.c index a6d264b36..3f4565083 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -282,7 +282,7 @@ static void rfc2231_join_continuations (PARAMETER **head, vl = strlen (par->value); - safe_realloc ((void **) &value, l + vl + 1); + safe_realloc (&value, l + vl + 1); strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */ l += vl; diff --git a/sendlib.c b/sendlib.c index 69209e281..90ca2c136 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1555,7 +1555,7 @@ static void write_references (LIST *r, FILE *f) for ( ; (TrimRef == 0 || refcnt < TrimRef) && r ; r = r->next) { if (refcnt == refmax) - safe_realloc ((void **) &ref, (refmax += REF_INC) * sizeof (LIST *)); + safe_realloc (&ref, (refmax += REF_INC) * sizeof (LIST *)); ref[refcnt++] = r; } @@ -1725,8 +1725,7 @@ static void encode_headers (LIST *h) continue; rfc2047_encode_string (&tmp); - safe_realloc ((void **) &h->data, - mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1); + safe_realloc (&h->data, mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1); sprintf (h->data + i, ": %s", NONULL (tmp)); /* __SPRINTF_CHECKED__ */ @@ -1951,7 +1950,7 @@ add_args (char **args, size_t *argslen, size_t *argsmax, ADDRESS *addr) if (addr->mailbox && !addr->group) { if (*argslen == *argsmax) - safe_realloc ((void **) &args, (*argsmax += 5) * sizeof (char *)); + safe_realloc (&args, (*argsmax += 5) * sizeof (char *)); args[(*argslen)++] = addr->mailbox; } } @@ -1962,7 +1961,7 @@ static char ** add_option (char **args, size_t *argslen, size_t *argsmax, char *s) { if (*argslen == *argsmax) - safe_realloc ((void **) &args, (*argsmax += 5) * sizeof (char *)); + safe_realloc (&args, (*argsmax += 5) * sizeof (char *)); args[(*argslen)++] = s; return (args); } @@ -1998,7 +1997,7 @@ mutt_invoke_sendmail (ADDRESS *from, /* the sender */ while ((ps = strtok (ps, " "))) { if (argslen == argsmax) - safe_realloc ((void **) &args, sizeof (char *) * (argsmax += 5)); + safe_realloc (&args, sizeof (char *) * (argsmax += 5)); if (i) args[argslen++] = ps; @@ -2040,7 +2039,7 @@ mutt_invoke_sendmail (ADDRESS *from, /* the sender */ args = add_args (args, &argslen, &argsmax, bcc); if (argslen == argsmax) - safe_realloc ((void **) &args, sizeof (char *) * (++argsmax)); + safe_realloc (&args, sizeof (char *) * (++argsmax)); args[argslen++] = NULL; @@ -2083,7 +2082,7 @@ mutt_invoke_sendmail (ADDRESS *from, /* the sender */ char *mutt_append_string (char *a, const char *b) { size_t la = mutt_strlen (a); - safe_realloc ((void **) &a, la + mutt_strlen (b) + 1); + safe_realloc (&a, la + mutt_strlen (b) + 1); strcpy (a + la, b); /* __STRCPY_CHECKED__ */ return (a); } @@ -2120,7 +2119,7 @@ char *mutt_quote_string (const char *s) if (INVALID_CHAR (*s)) { size_t o = pr - r; - safe_realloc ((void **) &r, ++rlen); + safe_realloc (&r, ++rlen); pr = r + o; *pr++ = '\\'; } diff --git a/smime.c b/smime.c index 51237edf2..a2da21f2b 100644 --- a/smime.c +++ b/smime.c @@ -792,7 +792,7 @@ char *smime_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) } keylist_size += mutt_strlen (keyID) + 1; - safe_realloc ((void **)&keylist, keylist_size); + safe_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s", keyID); /* __SPRINTF_CHECKED__ */ keylist_used = mutt_strlen (keylist); diff --git a/thread.c b/thread.c index 1f0ad33e3..b26a7878a 100644 --- a/thread.c +++ b/thread.c @@ -630,8 +630,7 @@ THREAD *mutt_sort_subthreads (THREAD *thread, int init) for (i = 0; thread; i++, thread = thread->prev) { if (i >= array_size) - safe_realloc ((void **) &array, - (array_size *= 2) * sizeof (THREAD *)); + safe_realloc (&array, (array_size *= 2) * sizeof (THREAD *)); array[i] = thread; } -- 2.40.0