From: Thomas Roessler Date: Tue, 10 Dec 2002 20:56:47 +0000 (+0000) Subject: Replace safe_free calls by the FREE macro. X-Git-Tag: mutt-1-5-3-rel~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b62866d93e48a510912a1f503d907a2320da9238;p=mutt Replace safe_free calls by the FREE macro. --- diff --git a/addrbook.c b/addrbook.c index cbc11c14..6a5036f5 100644 --- a/addrbook.c +++ b/addrbook.c @@ -231,6 +231,6 @@ new_aliases: rfc822_write_address (buf, buflen, AliasTable[t]->addr); mutt_menuDestroy (&menu); - safe_free ((void **) &AliasTable); + FREE (&AliasTable); } diff --git a/alias.c b/alias.c index b31e9b5e..5e551918 100644 --- a/alias.c +++ b/alias.c @@ -469,7 +469,7 @@ int mutt_alias_complete (char *s, size_t buflen) { a_cur = a_list; a_list = a_list->next; - safe_free ((void **) &a_cur); + FREE (&a_cur); } /* remove any aliases marked for deletion */ diff --git a/attach.c b/attach.c index 4e9bf5e6..171929a4 100644 --- a/attach.c +++ b/attach.c @@ -156,13 +156,13 @@ int mutt_compose_attachment (BODY *a) b->parameter = NULL; } if (b->description) { - safe_free ((void **) &a->description); + FREE (&a->description); a->description = b->description; b->description = NULL; } if (b->form_name) { - safe_free ((void **) &a->form_name); + FREE (&a->form_name); a->form_name = b->form_name; b->form_name = NULL; } @@ -356,9 +356,9 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) b->filename, type)); } if (tmp.subtype) - safe_free ((void **) &tmp.subtype); + FREE (&tmp.subtype); if (tmp.xtype) - safe_free ((void **) &tmp.xtype); + FREE (&tmp.xtype); } } } diff --git a/browser.c b/browser.c index 34778ac2..61fe713a 100644 --- a/browser.c +++ b/browser.c @@ -60,14 +60,14 @@ static void destroy_state (struct browser_state *state) for (c = 0; c < state->entrylen; c++) { - safe_free ((void **) &((state->entry)[c].name)); - safe_free ((void **) &((state->entry)[c].desc)); - safe_free ((void **) &((state->entry)[c].st)); + FREE (&((state->entry)[c].name)); + FREE (&((state->entry)[c].desc)); + FREE (&((state->entry)[c].st)); } #ifdef USE_IMAP - safe_free ((void **) &state->folder); + FREE (&state->folder); #endif - safe_free ((void **) &state->entry); + FREE (&state->entry); } static int browser_compare_subject (const void *a, const void *b) @@ -889,8 +889,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num if (!imap_delete_mailbox (Context, mx)) { /* free the mailbox from the browser */ - safe_free ((void **) &((state.entry)[nentry].name)); - safe_free ((void **) &((state.entry)[nentry].desc)); + FREE (&((state.entry)[nentry].name)); + FREE (&((state.entry)[nentry].desc)); /* and move all other entries up */ if (nentry+1 < state.entrylen) memmove (state.entry + nentry, state.entry + nentry + 1, @@ -995,14 +995,14 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { regerror (err, rx, buf, sizeof (buf)); regfree (rx); - safe_free ((void **) &rx); + FREE (&rx); mutt_error ("%s", buf); } else { mutt_str_replace (&Mask.pattern, buf); regfree (Mask.rx); - safe_free ((void **) &Mask.rx); + FREE (&Mask.rx); Mask.rx = rx; Mask.not = not; diff --git a/buffy.c b/buffy.c index ac740044..e0ef5d2f 100644 --- a/buffy.c +++ b/buffy.c @@ -179,9 +179,9 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e { for (tmp = &Incoming; *tmp;) { - safe_free((void **)&((*tmp)->path)); + FREE (&((*tmp)->path)); tmp1=(*tmp)->next; - safe_free((void **)tmp); + FREE (tmp); *tmp=tmp1; } return 0; @@ -203,9 +203,9 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e { if(*tmp) { - safe_free((void **)&((*tmp)->path)); + FREE (&((*tmp)->path)); tmp1=(*tmp)->next; - safe_free((void **)tmp); + FREE (tmp); *tmp=tmp1; } continue; diff --git a/charset.c b/charset.c index 86e7a3c7..65afc9e3 100644 --- a/charset.c +++ b/charset.c @@ -440,7 +440,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to, int flags) *ob = '\0'; - safe_free ((void **) ps); + FREE (ps); *ps = buf; mutt_str_adjust (ps); @@ -579,5 +579,5 @@ void fgetconv_close (FGETCONV **_fc) if (fc->cd != (iconv_t)-1) iconv_close (fc->cd); - safe_free ((void **) _fc); + FREE (_fc); } diff --git a/color.c b/color.c index 7a31588d..2265730a 100644 --- a/color.c +++ b/color.c @@ -124,8 +124,8 @@ static void mutt_free_color_line(COLOR_LINE **l, regfree(&tmp->rx); mutt_pattern_free(&tmp->color_pattern); - safe_free((void **)&tmp->pattern); - safe_free((void **)l); + FREE (&tmp->pattern); + FREE (l); } void ci_start_color (void) @@ -275,7 +275,7 @@ void mutt_free_color (int fg, int bg) if (p == ColorList) { ColorList = ColorList->next; - safe_free ((void **) &p); + FREE (&p); return; } q = ColorList; @@ -284,7 +284,7 @@ void mutt_free_color (int fg, int bg) if (q->next == p) { q->next = p->next; - safe_free ((void **) &p); + FREE (&p); return; } q = q->next; diff --git a/compose.c b/compose.c index 8b28c813..22881d0d 100644 --- a/compose.c +++ b/compose.c @@ -463,8 +463,8 @@ static int delete_attachment (MUTTMENU *menu, short *idxlen, int x) idx[x]->content->next = NULL; idx[x]->content->parts = NULL; mutt_free_body (&(idx[x]->content)); - safe_free ((void **) &idx[x]->tree); - safe_free ((void **) &idx[x]); + FREE (&idx[x]->tree); + FREE (&idx[x]); for (; x < *idxlen - 1; x++) idx[x] = idx[x+1]; menu->max = --(*idxlen); @@ -723,7 +723,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (idxlen && idx[idxlen - 1]->content->next) { for (i = 0; i < idxlen; i++) - safe_free ((void **) &idx[i]); + FREE (&idx[i]); idxlen = 0; idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1); menu->data = idx; @@ -758,7 +758,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ menu->redraw |= REDRAW_INDEX; } else - safe_free ((void **) &idx[idxlen]); + FREE (&idx[idxlen]); menu->redraw |= REDRAW_STATUS; @@ -807,7 +807,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ { error = 1; mutt_error (_("Unable to attach %s!"), att); - safe_free ((void **) &idx[idxlen]); + FREE (&idx[idxlen]); } } @@ -861,7 +861,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (!ctx->msgcount) { mx_close_mailbox (ctx, NULL); - safe_free ((void **) &ctx); + FREE (&ctx); mutt_error _("No messages in that folder."); break; } @@ -904,7 +904,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ else { mutt_error _("Unable to attach!"); - safe_free ((void **) &idx[idxlen]); + FREE (&idx[idxlen]); } } } @@ -914,7 +914,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ mx_close_mailbox (Context, NULL); else mx_fastclose_mailbox (Context); - safe_free ((void **) &Context); + FREE (&Context); /* go back to the folder we started from */ Context = this; @@ -1166,7 +1166,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (!(fp = safe_fopen (fname, "w"))) { mutt_error (_("Can't create file %s"), fname); - safe_free ((void **) &idx[idxlen]); + FREE (&idx[idxlen]); continue; } fclose (fp); @@ -1243,10 +1243,10 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ idx[idxlen]->content->next = NULL; idx[idxlen]->content->parts = NULL; mutt_free_body (&idx[idxlen]->content); - safe_free ((void **) &idx[idxlen]->tree); - safe_free ((void **) &idx[idxlen]); + FREE (&idx[idxlen]->tree); + FREE (&idx[idxlen]); } - safe_free ((void **) &idx); + FREE (&idx); idxlen = 0; idxmax = 0; r = -1; @@ -1389,12 +1389,12 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ { msg->content = idx[0]->content; for (i = 0; i < idxlen; i++) - safe_free ((void **) &idx[i]); + FREE (&idx[i]); } else msg->content = NULL; - safe_free ((void **) &idx); + FREE (&idx); return (r); } diff --git a/copy.c b/copy.c index 62a4f354..b99ad942 100644 --- a/copy.c +++ b/copy.c @@ -261,8 +261,8 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags, /* Free in a separate loop to be sure that all headers are freed * in case of error. */ for (x = 0; x < hdr_count; x++) - safe_free ((void **) &headers[x]); - safe_free ((void **) &headers); + FREE (&headers[x]); + FREE (&headers); if (error) return (-1); diff --git a/crypt.c b/crypt.c index 95b1fee9..d08ee7a0 100644 --- a/crypt.c +++ b/crypt.c @@ -770,7 +770,7 @@ void mutt_signed_handler (BODY *a, STATE *s) state_attach_puts (_("[-- The following data is signed --]\n\n"), s); - safe_free((void **) &signatures); + FREE (&signatures); } else state_attach_puts (_("[-- Warning: Can't find any signatures. --]\n\n"), s); diff --git a/curs_main.c b/curs_main.c index 599b5b0a..08b9f30e 100644 --- a/curs_main.c +++ b/curs_main.c @@ -481,7 +481,7 @@ int mutt_index_menu (void) if (!Context->path) { /* fatal error occurred */ - safe_free ((void **) &Context); + FREE (&Context); menu->redraw = REDRAW_FULL; } @@ -978,7 +978,7 @@ int mutt_index_menu (void) /* check for a fatal error, or all messages deleted */ if (!Context->path) - safe_free ((void **) &Context); + FREE (&Context); /* if we were in the pager, redisplay the message */ if (menu->menu == MENU_PAGER) @@ -1038,7 +1038,7 @@ int mutt_index_menu (void) menu->redraw = REDRAW_INDEX | REDRAW_STATUS; break; } - safe_free ((void **) &Context); + FREE (&Context); } mutt_sleep (0); @@ -1109,7 +1109,7 @@ int mutt_index_menu (void) if (Context) { mx_fastclose_mailbox (Context); - safe_free ((void **) &Context); + FREE (&Context); } done = 1; } diff --git a/enter.c b/enter.c index 4cef35f6..a5bf5a9d 100644 --- a/enter.c +++ b/enter.c @@ -165,7 +165,7 @@ static void replace_part (ENTER_STATE *state, size_t from, char *buf) memcpy (state->wbuf + state->curpos, savebuf, savelen * sizeof (wchar_t)); state->lastchar = state->curpos + savelen; - safe_free ((void **) &savebuf); + FREE (&savebuf); } /* @@ -686,7 +686,7 @@ self_insert: bye: - safe_free ((void **) &tempbuf); + FREE (&tempbuf); return rv; } @@ -694,8 +694,8 @@ void mutt_free_enter_state (ENTER_STATE **esp) { if (!esp) return; - safe_free ((void **) &(*esp)->wbuf); - safe_free ((void **) esp); + FREE (&(*esp)->wbuf); + FREE (esp); } /* diff --git a/gnupgparse.c b/gnupgparse.c index 01a0a6b5..ad8259c3 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -107,7 +107,7 @@ static void fix_uid (char *uid) else if (ob-buf == n && (buf[n] = 0, strlen (buf) < n)) memcpy (uid, buf, n); } - safe_free ((void **) &buf); + FREE (&buf); iconv_close (cd); } } diff --git a/hash.c b/hash.c index a9b7b5d9..c9037ca1 100644 --- a/hash.c +++ b/hash.c @@ -146,9 +146,9 @@ void hash_destroy (HASH **ptr, void (*destroy) (void *)) elem = elem->next; if (destroy) destroy (tmp->data); - safe_free ((void **) &tmp); + FREE (&tmp); } } - safe_free ((void **) &pptr->table); - safe_free ((void **) ptr); + FREE (&pptr->table); + FREE (ptr); } diff --git a/history.c b/history.c index 5130a7f0..1e9743fb 100644 --- a/history.c +++ b/history.c @@ -40,8 +40,8 @@ static void init_history (struct history *h) if (h->hist) { for (i = 0 ; i < OldSize ; i ++) - safe_free ((void **) &h->hist[i]); - safe_free ((void **) &h->hist); + FREE (&h->hist[i]); + FREE (&h->hist); } } diff --git a/hook.c b/hook.c index dbb62d8f..c1091219 100644 --- a/hook.c +++ b/hook.c @@ -165,7 +165,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { regerror (rc, rx, err->data, err->dsize); regfree (rx); - safe_free ((void **) &rx); + FREE (&rx); goto error; } } diff --git a/imap/command.c b/imap/command.c index bd01aa0e..d1d3ef39 100644 --- a/imap/command.c +++ b/imap/command.c @@ -192,7 +192,7 @@ int imap_exec (IMAP_DATA* idata, const char* cmd, int flags) rc = mutt_socket_write_d (idata->conn, out, flags & IMAP_CMD_PASS ? IMAP_LOG_PASS : IMAP_LOG_CMD); - safe_free ((void**) &out); + FREE (&out); if (rc < 0) { diff --git a/imap/imap.c b/imap/imap.c index cfb2e354..cf7258ec 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -869,7 +869,7 @@ int imap_make_msg_set (IMAP_DATA* idata, BUFFER* buf, int flag, int changed) } } - safe_free ((void**) &hdrs); + FREE (&hdrs); return count; } @@ -1089,7 +1089,7 @@ void imap_close_mailbox (CONTEXT* ctx) if (idata->cache[i].path) { unlink (idata->cache[i].path); - safe_free ((void **) &idata->cache[i].path); + FREE (&idata->cache[i].path); } } } diff --git a/imap/message.c b/imap/message.c index 289fc0d4..47136fda 100644 --- a/imap/message.c +++ b/imap/message.c @@ -254,7 +254,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) cache->path = safe_strdup (path); if (!(msg->fp = safe_fopen (path, "w+"))) { - safe_free ((void**) &cache->path); + FREE (&cache->path); return -1; } @@ -676,7 +676,7 @@ void imap_free_header_data (void** data) /* this should be safe even if the list wasn't used */ mutt_free_list (&(((IMAP_HEADER_DATA*) *data)->keywords)); - safe_free (data); + FREE (data); } /* imap_set_flags: fill out the message header according to the flags from diff --git a/imap/utf7.c b/imap/utf7.c index fc68203b..14211a07 100644 --- a/imap/utf7.c +++ b/imap/utf7.c @@ -130,7 +130,7 @@ static char *utf7_to_utf8 (const char *u7, size_t u7len, char **u8, return buf; bail: - safe_free ((void **) &buf); + FREE (&buf); return 0; } @@ -220,7 +220,7 @@ static char *utf8_to_utf7 (const char *u8, size_t u8len, char **u7, if (u8len) { - safe_free ((void **) &buf); + FREE (&buf); return 0; } @@ -239,7 +239,7 @@ static char *utf8_to_utf7 (const char *u8, size_t u8len, char **u7, return buf; bail: - safe_free ((void **) &buf); + FREE (&buf); return 0; } @@ -250,7 +250,7 @@ void imap_utf7_encode (char **s) char *t = safe_strdup (*s); if (!mutt_convert_string (&t, Charset, "UTF-8", 0)) utf8_to_utf7 (t, strlen (t), s, 0); - safe_free ((void **) &t); + FREE (&t); } } @@ -261,7 +261,7 @@ void imap_utf7_decode (char **s) char *t = utf7_to_utf8 (*s, strlen (*s), 0, 0); if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) { - safe_free ((void **) s); + FREE (s); *s = t; } } diff --git a/imap/util.c b/imap/util.c index 2aa1471e..10d93cd9 100644 --- a/imap/util.c +++ b/imap/util.c @@ -508,7 +508,7 @@ void imap_munge_mbox_name (char *dest, size_t dlen, const char *src) imap_quote_string (dest, dlen, buf); - safe_free ((void **) &buf); + FREE (&buf); } void imap_unmunge_mbox_name (char *s) @@ -524,7 +524,7 @@ void imap_unmunge_mbox_name (char *s) strncpy (s, buf, strlen (s)); } - safe_free ((void **) &buf); + FREE (&buf); } /* imap_wordcasecmp: find word a in word list b */ diff --git a/init.c b/init.c index 93c30c88..41710270 100644 --- a/init.c +++ b/init.c @@ -342,12 +342,12 @@ static void remove_from_list (LIST **l, const char *str) { if (ascii_strcasecmp (str, p->data) == 0) { - safe_free ((void **) &p->data); + FREE (&p->data); if (last) last->next = p->next; else (*l) = p->next; - safe_free ((void **) &p); + FREE (&p); } else { @@ -611,7 +611,7 @@ static int parse_my_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err if (ascii_strncasecmp (buf->data, tmp->data, keylen) == 0) { /* replace the old value */ - safe_free ((void **) &tmp->data); + FREE (&tmp->data); tmp->data = buf->data; memset (buf, 0, sizeof (BUFFER)); return 0; @@ -902,7 +902,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) if (DTYPE (MuttVars[idx].type) == DT_ADDR) rfc822_free_address ((ADDRESS **) MuttVars[idx].data); else - safe_free ((void **) MuttVars[idx].data); + FREE (MuttVars[idx].data); } else if (query || *s->dptr != '=') { @@ -1273,7 +1273,7 @@ static int source_rc (const char *rcfile, BUFFER *err) rc = -1; } FREE (&token.data); - safe_free ((void **) &linebuf); + FREE (&linebuf); fclose (f); if (pid != -1) mutt_wait_filter (pid); diff --git a/lib.c b/lib.c index a9dad9de..9e72d2cc 100644 --- a/lib.c +++ b/lib.c @@ -145,7 +145,7 @@ char *safe_strdup (const char *s) void mutt_str_replace (char **p, const char *s) { - safe_free ((void **) p); + FREE (p); *p = safe_strdup (s); } @@ -451,7 +451,7 @@ char *mutt_read_line (char *s, size_t *size, FILE *fp, int *line) { if (fgets (s + offset, *size - offset, fp) == NULL) { - safe_free ((void **) &s); + FREE (&s); return NULL; } if ((ch = strchr (s + offset, '\n')) != NULL) diff --git a/main.c b/main.c index 40d1c15c..93751302 100644 --- a/main.c +++ b/main.c @@ -797,7 +797,7 @@ int main (int argc, char **argv) } } - safe_free ((void **) &bodytext); + FREE (&bodytext); if (attach) { @@ -885,7 +885,7 @@ int main (int argc, char **argv) { mutt_index_menu (); if (Context) - safe_free ((void **)&Context); + FREE (&Context); } mutt_endwin (Errorbuf); } diff --git a/mbox.c b/mbox.c index fa0f2218..c9635092 100644 --- a/mbox.c +++ b/mbox.c @@ -991,8 +991,8 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) ctx->hdrs[i]->index = j++; } } - safe_free ((void **) &newOffset); - safe_free ((void **) &oldOffset); + FREE (&newOffset); + FREE (&oldOffset); unlink (tempfile); /* remove partial copy of the mailbox */ mutt_unblock_signals (); Sort = save_sort; /* Restore the default value. */ @@ -1020,8 +1020,8 @@ bail: /* Come here in case of disaster */ mbox_unlock_mailbox (ctx); mutt_unblock_signals (); - safe_free ((void **) &newOffset); - safe_free ((void **) &oldOffset); + FREE (&newOffset); + FREE (&oldOffset); if ((ctx->fp = freopen (ctx->path, "r", ctx->fp)) == NULL) { @@ -1085,12 +1085,12 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) if (ctx->subj_hash) hash_destroy (&ctx->subj_hash, NULL); mutt_clear_threads (ctx); - safe_free ((void **) &ctx->v2r); + FREE (&ctx->v2r); if (ctx->readonly) { for (i = 0; i < ctx->msgcount; i++) mutt_free_header (&(ctx->hdrs[i])); /* nothing to do! */ - safe_free ((void **) &ctx->hdrs); + FREE (&ctx->hdrs); } else { @@ -1140,7 +1140,7 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) /* free the old headers */ for (j = 0; j < old_msgcount; j++) mutt_free_header (&(old_hdrs[j])); - safe_free ((void **) &old_hdrs); + FREE (&old_hdrs); ctx->quiet = 0; return (-1); @@ -1219,7 +1219,7 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) msg_mod = 1; } } - safe_free ((void **) &old_hdrs); + FREE (&old_hdrs); } ctx->quiet = 0; diff --git a/menu.c b/menu.c index 9c288fad..3e4e65fe 100644 --- a/menu.c +++ b/menu.c @@ -683,17 +683,17 @@ void mutt_menuDestroy (MUTTMENU **p) { int i; - safe_free ((void **) &(*p)->searchBuf); + FREE (&(*p)->searchBuf); if ((*p)->dialog) { for (i=0; i < (*p)->max; i++) - safe_free ((void **) &(*p)->dialog[i]); + FREE (&(*p)->dialog[i]); - safe_free ((void **) (*p)->dialog); + FREE ((*p)->dialog); } - safe_free ((void **) p); + FREE (p); } #define M_SEARCH_UP 1 diff --git a/mh.c b/mh.c index ebe93e36..9db7a2fd 100644 --- a/mh.c +++ b/mh.c @@ -81,7 +81,7 @@ static void mhs_alloc (struct mh_sequences *mhs, int i) static void mhs_free_sequences (struct mh_sequences *mhs) { - safe_free ((void **) &mhs->flags); + FREE (&mhs->flags); } static short mhs_check (struct mh_sequences *mhs, int i) @@ -164,7 +164,7 @@ static void mh_read_sequences (struct mh_sequences *mhs, const char *path) } } - safe_free ((void **) &buff); + FREE (&buff); safe_fclose (&fp); } @@ -366,7 +366,7 @@ void mh_update_sequences (CONTEXT * ctx) unlink (tmpfname); } - safe_free ((void **) &tmpfname); + FREE (&tmpfname); } static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen, @@ -423,7 +423,7 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen, } } safe_fclose (&ofp); - safe_free ((void **) &buff); + FREE (&buff); if (!unseen_done && unseen) fprintf (nfp, "%s: %d\n", NONULL (MhUnseen), n); @@ -438,7 +438,7 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen, if (safe_rename (tmpfname, sequences) != 0) unlink (tmpfname); - safe_free ((void **) &tmpfname); + FREE (&tmpfname); } static void mh_update_maildir (struct maildir *md, struct mh_sequences *mhs) @@ -470,11 +470,11 @@ static void maildir_free_entry (struct maildir **md) if (!md || !*md) return; - safe_free ((void **) &(*md)->canon_fname); + FREE (&(*md)->canon_fname); if ((*md)->h) mutt_free_header (&(*md)->h); - safe_free ((void **) md); + FREE (md); } static void maildir_free_maildir (struct maildir **md) @@ -539,7 +539,7 @@ static void maildir_parse_flags (HEADER * h, const char *path) } if (q == h->maildir_flags) - safe_free ((void **) &h->maildir_flags); + FREE (&h->maildir_flags); else if (q) *q = '\0'; } @@ -1622,7 +1622,7 @@ int mh_check_mailbox (CONTEXT * ctx, int *index_hint) safe_fclose (&fp); if (safe_rename (tmp, buf) == -1) unlink (tmp); - safe_free ((void **) &tmp); + FREE (&tmp); } } diff --git a/mutt_ssl.c b/mutt_ssl.c index e9c2200d..d5add0fe 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -355,7 +355,7 @@ static int ssl_socket_close (CONNECTION * conn) X509_free (data->cert); SSL_free (data->ssl); SSL_CTX_free (data->ctx); - safe_free ((void **) &conn->sockdata); + FREE (&conn->sockdata); } return raw_socket_close (conn); diff --git a/mutt_ssl_nss.c b/mutt_ssl_nss.c index abd91fba..9549d99f 100644 --- a/mutt_ssl_nss.c +++ b/mutt_ssl_nss.c @@ -332,7 +332,7 @@ mutt_nss_socket_open (CONNECTION * con) PR_Close (sockdata->fd); if (sockdata->db) CERT_ClosePermCertDB (sockdata->db); - safe_free ((void **) &sockdata); + FREE (&sockdata); } return -1; } @@ -348,7 +348,7 @@ mutt_nss_socket_close (CONNECTION * con) if (sockdata->db) CERT_ClosePermCertDB (sockdata->db); /* free up the memory we used for this connection specific to NSS. */ - safe_free ((void **) &con->sockdata); + FREE (&con->sockdata); return 0; } diff --git a/muttlib.c b/muttlib.c index 00605925..d122814c 100644 --- a/muttlib.c +++ b/muttlib.c @@ -183,12 +183,12 @@ void mutt_free_body (BODY **p) mutt_free_parameter (&b->parameter); if (b->unlink && b->filename) unlink (b->filename); - safe_free ((void **) &b->filename); - safe_free ((void **) &b->content); - safe_free ((void **) &b->xtype); - safe_free ((void **) &b->subtype); - safe_free ((void **) &b->description); - safe_free ((void **) &b->form_name); + FREE (&b->filename); + FREE (&b->content); + FREE (&b->xtype); + FREE (&b->subtype); + FREE (&b->description); + FREE (&b->form_name); if (b->hdr) { @@ -200,7 +200,7 @@ void mutt_free_body (BODY **p) if (b->parts) mutt_free_body (&b->parts); - safe_free ((void **) &b); + FREE (&b); } *p = 0; @@ -213,11 +213,11 @@ void mutt_free_parameter (PARAMETER **p) while (t) { - safe_free ((void **) &t->attribute); - safe_free ((void **) &t->value); + FREE (&t->attribute); + FREE (&t->value); o = t; t = t->next; - safe_free ((void **) &o); + FREE (&o); } *p = 0; } @@ -250,8 +250,8 @@ void mutt_free_list (LIST **list) { p = *list; *list = (*list)->next; - safe_free ((void **) &p->data); - safe_free ((void **) &p); + FREE (&p->data); + FREE (&p); } } @@ -269,16 +269,16 @@ void mutt_free_header (HEADER **h) if(!h || !*h) return; mutt_free_envelope (&(*h)->env); mutt_free_body (&(*h)->content); - safe_free ((void **) &(*h)->maildir_flags); - safe_free ((void **) &(*h)->tree); - safe_free ((void **) &(*h)->path); + FREE (&(*h)->maildir_flags); + FREE (&(*h)->tree); + FREE (&(*h)->path); #ifdef MIXMASTER mutt_free_list (&(*h)->chain); #endif #if defined USE_POP || defined USE_IMAP - safe_free ((void**) &(*h)->data); + FREE (&(*h)->data); #endif - safe_free ((void **) h); + FREE (h); } /* returns true if the header contained in "s" is in list "t" */ @@ -662,14 +662,14 @@ void mutt_free_envelope (ENVELOPE **p) rfc822_free_address (&(*p)->from); rfc822_free_address (&(*p)->reply_to); rfc822_free_address (&(*p)->mail_followup_to); - safe_free ((void **) &(*p)->subject); - safe_free ((void **) &(*p)->message_id); - safe_free ((void **) &(*p)->supersedes); - safe_free ((void **) &(*p)->date); + FREE (&(*p)->subject); + FREE (&(*p)->message_id); + FREE (&(*p)->supersedes); + FREE (&(*p)->date); mutt_free_list (&(*p)->references); mutt_free_list (&(*p)->in_reply_to); mutt_free_list (&(*p)->userhdrs); - safe_free ((void **) p); + FREE (p); } void mutt_mktemp (char *s) @@ -686,9 +686,9 @@ void mutt_free_alias (ALIAS **p) { t = *p; *p = (*p)->next; - safe_free ((void **) &t->name); + FREE (&t->name); rfc822_free_address (&t->addr); - safe_free ((void **) &t); + FREE (&t); } } @@ -1135,7 +1135,7 @@ FILE *mutt_open_read (const char *path, pid_t *thepid) s[len - 1] = 0; mutt_endwin (NULL); *thepid = mutt_create_filter (s, NULL, &f, NULL); - safe_free ((void **) &s); + FREE (&s); } else { diff --git a/mx.c b/mx.c index 716a5a43..4da78237 100644 --- a/mx.c +++ b/mx.c @@ -757,10 +757,10 @@ void mx_fastclose_mailbox (CONTEXT *ctx) mutt_clear_threads (ctx); for (i = 0; i < ctx->msgcount; i++) mutt_free_header (&ctx->hdrs[i]); - safe_free ((void **) &ctx->hdrs); - safe_free ((void **) &ctx->v2r); - safe_free ((void **) &ctx->path); - safe_free ((void **) &ctx->pattern); + FREE (&ctx->hdrs); + FREE (&ctx->v2r); + FREE (&ctx->path); + FREE (&ctx->pattern); if (ctx->limit_pattern) mutt_pattern_free (&ctx->limit_pattern); safe_fclose (&ctx->fp); @@ -1315,7 +1315,7 @@ MESSAGE *mx_open_new_message (CONTEXT *dest, HEADER *hdr, int flags) } } else - safe_free ((void **) &msg); + FREE (&msg); return msg; } @@ -1594,7 +1594,7 @@ void mx_update_context (CONTEXT *ctx, int new_messages) h2 = hash_find (ctx->id_hash, h->env->supersedes); - /* safe_free (&h->env->supersedes); should I ? */ + /* FREE (&h->env->supersedes); should I ? */ if (h2) { h2->superseded = 1; diff --git a/pager.c b/pager.c index 568f20a3..7f6c735c 100644 --- a/pager.c +++ b/pager.c @@ -384,8 +384,8 @@ cleanup_quote (struct q_class_t **QuoteList) cleanup_quote (&((*QuoteList)->down)); ptr = (*QuoteList)->next; if ((*QuoteList)->prefix) - safe_free ((void **) &(*QuoteList)->prefix); - safe_free ((void **) QuoteList); + FREE (&(*QuoteList)->prefix); + FREE (QuoteList); *QuoteList = ptr; } @@ -1613,7 +1613,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) lines = Resize->line; redraw |= REDRAW_SIGWINCH; - safe_free ((void **) &Resize); + FREE (&Resize); } #endif @@ -1796,7 +1796,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) safe_realloc ((void **)&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) - safe_free ((void **) &(lineInfo[i].search)); + FREE (&(lineInfo[i].search)); } lastLine = 0; @@ -1993,7 +1993,7 @@ search_next: for (i = 0; i < lastLine; i++) { if (lineInfo[i].search) - safe_free ((void **) &(lineInfo[i].search)); + FREE (&(lineInfo[i].search)); lineInfo[i].search_cnt = -1; } } @@ -2007,7 +2007,7 @@ search_next: { /* cleanup */ if (lineInfo[i].search) - safe_free ((void **) &(lineInfo[i].search)); + FREE (&(lineInfo[i].search)); lineInfo[i].search_cnt = -1; } SearchFlag = 0; @@ -2289,7 +2289,7 @@ search_next: safe_realloc ((void **)&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) - safe_free ((void **) &(lineInfo[i].search)); + FREE (&(lineInfo[i].search)); } if (SearchCompiled) @@ -2596,16 +2596,16 @@ search_next: for (i = 0; i < maxLine ; i++) { - safe_free ((void **) &(lineInfo[i].syntax)); + FREE (&(lineInfo[i].syntax)); if (SearchCompiled && lineInfo[i].search) - safe_free ((void **) &(lineInfo[i].search)); + FREE (&(lineInfo[i].search)); } if (SearchCompiled) { regfree (&SearchRE); SearchCompiled = 0; } - safe_free ((void **) &lineInfo); + FREE (&lineInfo); if (index) mutt_menuDestroy(&index); return (rc != -1 ? rc : 0); diff --git a/parse.c b/parse.c index 50c8a454..f90fc726 100644 --- a/parse.c +++ b/parse.c @@ -143,7 +143,7 @@ static LIST *mutt_parse_references (char *s, int in_reply_to) */ if (!(at = strchr (new, '@')) || strchr (at + 1, '@') || (in_reply_to && at - new <= 8)) - safe_free ((void **) &new); + FREE (&new); else { t = (LIST *) safe_malloc (sizeof (LIST)); @@ -314,7 +314,7 @@ void mutt_parse_content_type (char *s, BODY *ct) char *pc; char *subtype; - safe_free((void **)&ct->subtype); + FREE (&ct->subtype); mutt_free_parameter(&ct->parameter); /* First extract any existing parameters */ @@ -1087,7 +1087,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short else if (!ascii_strcasecmp (line + 1, "essage-id")) { /* We add a new "Message-Id:" when building a message */ - safe_free ((void **) &e->message_id); + FREE (&e->message_id); e->message_id = extract_message_id (p); matched = 1; } diff --git a/pattern.c b/pattern.c index 9552e806..70cfaccb 100644 --- a/pattern.c +++ b/pattern.c @@ -266,7 +266,7 @@ int eat_regexp (pattern_t *pat, BUFFER *s, BUFFER *err) { regerror (r, pat->rx, err->data, err->dsize); regfree (pat->rx); - safe_free ((void **) &pat->rx); + FREE (&pat->rx); return (-1); } return 0; @@ -708,11 +708,11 @@ void mutt_pattern_free (pattern_t **pat) if (tmp->rx) { regfree (tmp->rx); - safe_free ((void **) &tmp->rx); + FREE (&tmp->rx); } if (tmp->child) mutt_pattern_free (&tmp->child); - safe_free ((void **) &tmp); + FREE (&tmp); } } @@ -1205,7 +1205,7 @@ int mutt_pattern_func (int op, char *prompt) if (op == M_LIMIT) { - safe_free ((void **) &Context->pattern); + FREE (&Context->pattern); if (Context->limit_pattern) mutt_pattern_free (&Context->limit_pattern); if (!Context->vcount) diff --git a/pgp.c b/pgp.c index 4f26ba5f..3528cd22 100644 --- a/pgp.c +++ b/pgp.c @@ -123,7 +123,7 @@ static int pgp_copy_checksig (FILE *fpin, FILE *fpout) fputs (line, fpout); fputc ('\n', fpout); } - safe_free ((void **) &line); + FREE (&line); } else { @@ -1090,7 +1090,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) } else if (r == -1) { - safe_free ((void **) &keylist); + FREE (&keylist); rfc822_free_address (&tmp); rfc822_free_address (&addr); return NULL; @@ -1107,7 +1107,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) if ((key = pgp_ask_for_key (buf, q->mailbox, KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) { - safe_free ((void **)&keylist); + FREE (&keylist); rfc822_free_address (&tmp); rfc822_free_address (&addr); return NULL; diff --git a/pgpkey.c b/pgpkey.c index 2ef935af..19c8e468 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -646,7 +646,7 @@ static pgp_key_t *pgp_select_key (pgp_key_t *keys, } mutt_menuDestroy (&menu); - safe_free ((void **) &KeyTable); + FREE (&KeyTable); set_option (OPTNEEDREDRAW); @@ -795,7 +795,7 @@ static LIST *pgp_add_string_to_hints (LIST *hints, const char *str) hints = mutt_add_list (hints, t); } - safe_free ((void **) &scratch); + FREE (&scratch); return hints; } diff --git a/pgplib.c b/pgplib.c index dd1b4751..a9528a29 100644 --- a/pgplib.c +++ b/pgplib.c @@ -126,7 +126,7 @@ void pgp_free_sig (pgp_sig_t **sigp) for (sp = *sigp; sp; sp = q) { q = sp->next; - safe_free ((void **) &sp); + FREE (&sp); } *sigp = NULL; @@ -142,8 +142,8 @@ void pgp_free_uid (pgp_uid_t ** upp) { q = up->next; pgp_free_sig (&up->sigs); - safe_free ((void **) &up->addr); - safe_free ((void **) &up); + FREE (&up->addr); + FREE (&up); } *upp = NULL; @@ -177,8 +177,8 @@ static void _pgp_free_key (pgp_key_t ** kpp) kp = *kpp; pgp_free_uid (&kp->address); - safe_free ((void **) &kp->keyid); - safe_free ((void **) kpp); + FREE (&kp->keyid); + FREE (kpp); } pgp_key_t *pgp_remove_key (pgp_key_t ** klist, pgp_key_t * key) diff --git a/pgppacket.c b/pgppacket.c index caec05c3..f6c64a53 100644 --- a/pgppacket.c +++ b/pgppacket.c @@ -220,6 +220,6 @@ bail: void pgp_release_packet (void) { plen = 0; - safe_free ((void **) &pbuf); + FREE (&pbuf); } diff --git a/pgppubring.c b/pgppubring.c index 7e8fd51f..892c9ded 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -258,7 +258,7 @@ static pgp_key_t *pgp_parse_pgp2_key (unsigned char *buff, size_t l) bailout: - safe_free ((void **) &p); + FREE (&p); return NULL; } @@ -766,7 +766,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh error_buf = safe_malloc (error_buf_len); snprintf (error_buf, error_buf_len, "fopen: %s", ringfile); perror (error_buf); - safe_free ((void **) &error_buf); + FREE (&error_buf); return; } @@ -808,7 +808,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh pgp_free_key (&p); } - safe_free ((void **) &tmp); + FREE (&tmp); } FGETPOS(rfp,pos); diff --git a/pop.c b/pop.c index 637dc26b..0be15c60 100644 --- a/pop.c +++ b/pop.c @@ -308,7 +308,7 @@ static void pop_clear_cache (POP_DATA *pop_data) if (pop_data->cache[i].path) { unlink (pop_data->cache[i].path); - safe_free ((void **) &pop_data->cache[i].path); + FREE (&pop_data->cache[i].path); } } } diff --git a/pop_auth.c b/pop_auth.c index 8ca1cdf4..253883d7 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -127,7 +127,7 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA *pop_data, const char *method) /* sasl_client_st(art|ep) allocate pc with malloc, expect me to * free it */ - safe_free ((void *) &pc); + FREE (&pc); } } diff --git a/postpone.c b/postpone.c index c739f504..60ad0193 100644 --- a/postpone.c +++ b/postpone.c @@ -247,7 +247,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size { PostCount = 0; mx_close_mailbox (PostContext, NULL); - safe_free ((void **) &PostContext); + FREE (&PostContext); mutt_error _("No postponed messages."); return (-1); } @@ -260,14 +260,14 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size else if ((h = select_msg ()) == NULL) { mx_close_mailbox (PostContext, NULL); - safe_free ((void **) &PostContext); + FREE (&PostContext); return (-1); } if (mutt_prepare_template (NULL, PostContext, hdr, h, 0) < 0) { mx_fastclose_mailbox (PostContext); - safe_free ((void **) &PostContext); + FREE (&PostContext); return (-1); } @@ -283,7 +283,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size mx_close_mailbox (PostContext, NULL); set_quadoption (OPT_DELETE, opt_delete); - safe_free ((void **) &PostContext); + FREE (&PostContext); for (tmp = hdr->env->userhdrs; tmp; ) { @@ -542,8 +542,8 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, newhdr->content->length = hdr->content->length; mutt_parse_part (fp, newhdr->content); - safe_free ((void **) &newhdr->env->message_id); - safe_free ((void **) &newhdr->env->mail_followup_to); /* really? */ + FREE (&newhdr->env->message_id); + FREE (&newhdr->env->mail_followup_to); /* really? */ #ifdef HAVE_PGP /* decrypt pgp/mime encoded messages */ diff --git a/query.c b/query.c index 3c6dde9e..8361d083 100644 --- a/query.c +++ b/query.c @@ -131,7 +131,7 @@ static QUERY *run_query (char *s, int quiet) } } } - safe_free ((void **) &buf); + FREE (&buf); fclose (fp); if (mutt_wait_filter (thepid)) { @@ -332,14 +332,14 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) while (queryp) { rfc822_free_address (&queryp->addr); - safe_free ((void **)&queryp->name); - safe_free ((void **)&queryp->other); + FREE (&queryp->name); + FREE (&queryp->other); results = queryp->next; - safe_free ((void **)&queryp); + FREE (&queryp); queryp = results; } results = newresults; - safe_free ((void **) &QueryTable); + FREE (&QueryTable); } else { @@ -487,13 +487,13 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) while (queryp) { rfc822_free_address (&queryp->addr); - safe_free ((void **)&queryp->name); - safe_free ((void **)&queryp->other); + FREE (&queryp->name); + FREE (&queryp->other); results = queryp->next; - safe_free ((void **)&queryp); + FREE (&queryp); queryp = results; } - safe_free ((void **) &QueryTable); + FREE (&QueryTable); /* tell whoever called me to redraw the screen when I return */ set_option (OPTNEEDREDRAW); diff --git a/recvattach.c b/recvattach.c index 4ec18eb5..0474f62e 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1150,12 +1150,12 @@ void mutt_view_attachments (HEADER *hdr) continue; if (idx[idxmax]->content && idx[idxmax]->content->deleted) hdr->attach_del = 1; - safe_free ((void **) &idx[idxmax]->tree); - safe_free ((void **) &idx[idxmax]); + FREE (&idx[idxmax]->tree); + FREE (&idx[idxmax]); } if (hdr->attach_del) hdr->changed = 1; - safe_free ((void **) &idx); + FREE (&idx); idxmax = 0; diff --git a/remailer.c b/remailer.c index 490ecc53..e1fb9c96 100644 --- a/remailer.c +++ b/remailer.c @@ -118,11 +118,11 @@ static REMAILER *mix_new_remailer (void) static void mix_free_remailer (REMAILER **r) { - safe_free ((void **) &(*r)->shortname); - safe_free ((void **) &(*r)->addr); - safe_free ((void **) &(*r)->ver); + FREE (&(*r)->shortname); + FREE (&(*r)->addr); + FREE (&(*r)->ver); - safe_free ((void **) r); + FREE (r); } /* parse the type2.list as given by mixmaster -T */ @@ -212,7 +212,7 @@ static void mix_free_type2_list (REMAILER ***ttlp) for (i = 0; type2_list[i]; i++) mix_free_remailer (&type2_list[i]); - safe_free ((void **) type2_list); + FREE (type2_list); } @@ -693,8 +693,8 @@ void mix_make_chain (LIST **chainp, int *redraw) } mix_free_type2_list (&type2_list); - safe_free ((void **) &coords); - safe_free ((void **) &chain); + FREE (&coords); + FREE (&chain); } /* some safety checks before piping the message to mixmaster */ diff --git a/rfc1524.c b/rfc1524.c index f4210699..f028730f 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -330,13 +330,13 @@ static int rfc1524_mailcap_parse (BODY *a, /* reset */ if (entry) { - safe_free ((void **) &entry->command); - safe_free ((void **) &entry->composecommand); - safe_free ((void **) &entry->composetypecommand); - safe_free ((void **) &entry->editcommand); - safe_free ((void **) &entry->printcommand); - safe_free ((void **) &entry->nametemplate); - safe_free ((void **) &entry->convert); + FREE (&entry->command); + FREE (&entry->composecommand); + FREE (&entry->composetypecommand); + FREE (&entry->editcommand); + FREE (&entry->printcommand); + FREE (&entry->nametemplate); + FREE (&entry->convert); entry->needsterminal = 0; entry->copiousoutput = 0; } @@ -344,7 +344,7 @@ static int rfc1524_mailcap_parse (BODY *a, } /* while (!found && (buf = mutt_read_line ())) */ fclose (fp); } /* if ((fp = fopen ())) */ - safe_free ((void **) &buf); + FREE (&buf); return found; } @@ -357,14 +357,14 @@ void rfc1524_free_entry(rfc1524_entry **entry) { rfc1524_entry *p = *entry; - safe_free((void **)&p->command); - safe_free((void **)&p->testcommand); - safe_free((void **)&p->composecommand); - safe_free((void **)&p->composetypecommand); - safe_free((void **)&p->editcommand); - safe_free((void **)&p->printcommand); - safe_free((void **)&p->nametemplate); - safe_free((void **)entry); + FREE (&p->command); + FREE (&p->testcommand); + FREE (&p->composecommand); + FREE (&p->composetypecommand); + FREE (&p->editcommand); + FREE (&p->printcommand); + FREE (&p->nametemplate); + FREE (entry); } /* diff --git a/rfc2047.c b/rfc2047.c index e7c4d725..759e3e3d 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -67,7 +67,7 @@ static size_t convert_string (ICONV_CONST char *f, size_t flen, if (n == (size_t)(-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t)(-1)) { e = errno; - safe_free ((void **) &buf); + FREE (&buf); iconv_close (cd); errno = e; return (size_t)(-1); @@ -117,23 +117,23 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, if (!tocode || n < bestn) { bestn = n; - safe_free ((void **) &tocode); + FREE (&tocode); tocode = t; if (d) { - safe_free ((void **) &e); + FREE (&e); e = s; } else - safe_free ((void **) &s); + FREE (&s); elen = slen; if (!bestn) break; } else { - safe_free ((void **) &t); - safe_free ((void **) &s); + FREE (&t); + FREE (&s); } } if (tocode) @@ -533,8 +533,8 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, bufpos += wlen; memcpy (buf + bufpos, t1, u + ulen - t1); - safe_free ((void **) &tocode1); - safe_free ((void **) &u); + FREE (&tocode1); + FREE (&u); buf[buflen] = '\0'; @@ -560,7 +560,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) Charset, charsets, &e, &elen, encode_specials ? RFC822Specials : NULL); - safe_free ((void **) pd); + FREE (pd); *pd = e; } @@ -612,8 +612,8 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) enc = ENCBASE64; else { - safe_free ((void **) &charset); - safe_free ((void **) &d0); + FREE (&charset); + FREE (&d0); return (-1); } break; @@ -681,8 +681,8 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) if (charset) mutt_convert_string (&d0, charset, Charset, M_ICONV_HOOK_FROM); strfcpy (d, d0, len); - safe_free ((void **) &charset); - safe_free ((void **) &d0); + FREE (&charset); + FREE (&d0); return (0); } @@ -771,7 +771,7 @@ void rfc2047_decode (char **pd) } *d = 0; - safe_free ((void **) pd); + FREE (pd); *pd = d0; mutt_str_adjust (pd); } diff --git a/rfc2231.c b/rfc2231.c index 3c39658f..188ea7d1 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -150,7 +150,7 @@ void rfc2231_decode_parameters (PARAMETER **headp) p->attribute = NULL; p->value = NULL; - safe_free ((void **) &p); + FREE (&p); rfc2231_list_insert (&conthead, conttmp); } @@ -177,9 +177,9 @@ static void rfc2231_free_parameter (struct rfc2231_parameter **p) { if (*p) { - safe_free ((void **) &(*p)->attribute); - safe_free ((void **) &(*p)->value); - safe_free ((void **) p); + FREE (&(*p)->attribute); + FREE (&(*p)->value); + FREE (p); } } @@ -357,17 +357,17 @@ int rfc2231_encode_string (char **pd) *t = '\0'; if (d != *pd) - safe_free ((void **) &d); - safe_free ((void **) pd); + FREE (&d); + FREE (pd); *pd = e; } else if (d != *pd) { - safe_free ((void **) pd); + FREE (pd); *pd = d; } - safe_free ((void **) &charset); + FREE (&charset); return encode; } diff --git a/rfc822.c b/rfc822.c index 797f2d94..c7cc97b3 100644 --- a/rfc822.c +++ b/rfc822.c @@ -509,7 +509,7 @@ void rfc822_qualify (ADDRESS *addr, const char *host) { p = safe_malloc (mutt_strlen (addr->mailbox) + mutt_strlen (host) + 2); sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */ - safe_free ((void **) &addr->mailbox); + FREE (&addr->mailbox); addr->mailbox = p; } } diff --git a/score.c b/score.c index a9dc638c..c460a2a2 100644 --- a/score.c +++ b/score.c @@ -154,7 +154,7 @@ int mutt_parse_unscore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) last = tmp; tmp = tmp->next; mutt_pattern_free (&last->pat); - safe_free ((void **) &last); + FREE (&last); } Score = NULL; } @@ -169,7 +169,7 @@ int mutt_parse_unscore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) else Score = tmp->next; mutt_pattern_free (&tmp->pat); - safe_free ((void **) &tmp); + FREE (&tmp); /* there should only be one score per pattern, so we can stop here */ break; } diff --git a/send.c b/send.c index 01e39544..6fff3462 100644 --- a/send.c +++ b/send.c @@ -1683,7 +1683,7 @@ cleanup: if(signas) { - safe_free((void **) &PgpSignAs); + FREE (&PgpSignAs); PgpSignAs = signas; } } diff --git a/sendlib.c b/sendlib.c index c9a18481..1c628719 100644 --- a/sendlib.c +++ b/sendlib.c @@ -392,7 +392,7 @@ int mutt_write_mime_header (BODY *a, FILE *f) if (!ascii_strcasecmp (p->attribute, "boundary") && !strcmp (buffer, tmp)) snprintf (buffer, sizeof (buffer), "\"%s\"", tmp); - safe_free ((void **)&tmp); + FREE (&tmp); tmplen = mutt_strlen (buffer) + mutt_strlen (p->attribute) + 1; @@ -438,7 +438,7 @@ int mutt_write_mime_header (BODY *a, FILE *f) tmp = safe_strdup (t); encode = rfc2231_encode_string (&tmp); rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials); - safe_free ((void **)&tmp); + FREE (&tmp); fprintf (f, "; filename%s=%s", encode ? "*" : "", buffer); } } @@ -809,10 +809,10 @@ static size_t convert_file_to (FILE *file, const char *fromcode, iconv_close (cd[i]); iconv_close (cd1); - safe_free ((void **) &cd); - safe_free ((void **) &infos); - safe_free ((void **) &score); - safe_free ((void **) &states); + FREE (&cd); + FREE (&infos); + FREE (&score); + FREE (&states); return ret; #else @@ -878,7 +878,7 @@ static size_t convert_file_from_to (FILE *file, tcode[cn] = 0; break; } - safe_free ((void **) &fcode); + FREE (&fcode); } } else @@ -895,9 +895,9 @@ static size_t convert_file_from_to (FILE *file, /* Free memory */ for (i = 0; i < ncodes; i++) - safe_free ((void **) &tcode[i]); + FREE (&tcode[i]); - safe_free ((void **) tcode); + FREE (tcode); return ret; } @@ -954,7 +954,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY *b) mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode); mutt_set_parameter ("charset", chsbuf, &b->parameter); } - safe_free ((void **) &tocode); + FREE (&tocode); safe_fclose (&fp); return info; } @@ -1132,7 +1132,7 @@ void mutt_message_to_7bit (BODY *a, FILE *fp) mutt_write_mime_body (a->parts, fpout); cleanup: - safe_free ((void **) &line); + FREE (&line); if (fpin && !fp) fclose (fpin); @@ -1300,7 +1300,7 @@ void mutt_update_encoding (BODY *a) mutt_set_encoding (a, info); mutt_stamp_attachment(a); - safe_free ((void **) &a->content); + FREE (&a->content); a->content = info; } @@ -1594,7 +1594,7 @@ static void write_references (LIST *r, FILE *f) fputs (ref[refcnt]->data, f); } - safe_free ((void **) &ref); + FREE (&ref); } /* Note: all RFC2047 encoding should be done outside of this routine, except @@ -1757,7 +1757,7 @@ static void encode_headers (LIST *h) sprintf (h->data + i, ": %s", NONULL (tmp)); /* __SPRINTF_CHECKED__ */ - safe_free ((void **) &tmp); + FREE (&tmp); } } @@ -1898,7 +1898,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) else if (pid == -1) { unlink (msg); - safe_free ((void **) tempfile); + FREE (tempfile); _exit (S_ERR); } @@ -1929,7 +1929,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) if (SendmailWait && st == (0xff & EX_OK)) { unlink (*tempfile); /* no longer needed */ - safe_free ((void **) tempfile); + FREE (tempfile); } } else @@ -1939,7 +1939,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) if (SendmailWait > 0) { unlink (*tempfile); - safe_free ((void **) tempfile); + FREE (tempfile); } } @@ -1951,7 +1951,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) { /* the parent is already dead */ unlink (*tempfile); - safe_free ((void **) tempfile); + FREE (tempfile); } _exit (st); diff --git a/smime.c b/smime.c index 6819a63d..8ca5bb9b 100644 --- a/smime.c +++ b/smime.c @@ -514,7 +514,7 @@ char* smime_ask_for_key (char *prompt, char *mailbox, short public) else fname = NULL; mutt_menuDestroy (&menu); - safe_free ((void**)&Table); + FREE (&Table); set_option (OPTNEEDREDRAW); if (fname) return fname; @@ -596,7 +596,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, short m { found = 0; ask = 0; - safe_free((void **) &key); + FREE (&key); key = NULL; break; } @@ -662,7 +662,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, short m choice = mutt_yesorno (prompt, M_NO); if (choice == -1 || choice == M_NO) { - safe_free ((void **) &key); + FREE (&key); key = NULL; } } @@ -676,7 +676,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, short m choice = mutt_yesorno (prompt, M_NO); if (choice != M_YES) { - safe_free ((void **) &key); + FREE (&key); key = NULL; } @@ -729,7 +729,7 @@ void _smime_getkeys (char *mailbox) if (*SmimeKeyToUse && !mutt_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys)+1)) { - safe_free ((void **) &k); + FREE (&k); return; } else smime_void_passphrase (); @@ -743,7 +743,7 @@ void _smime_getkeys (char *mailbox) if (mutt_strcasecmp (k, SmimeDefaultKey)) smime_void_passphrase (); - safe_free ((void **) &k); + FREE (&k); return; } @@ -850,7 +850,7 @@ char *smime_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) if(!keyID) { mutt_message (_("No (valid) certificate found for %s."), q->mailbox); - safe_free ((void **)&keylist); + FREE (&keylist); rfc822_free_address (&tmp); rfc822_free_address (&addr); return NULL; @@ -1191,7 +1191,7 @@ void smime_invoke_import (char *infile, char *mailbox) mutt_wait_filter (thepid); mutt_unlink (certfile); - safe_free((void **)&certfile); + FREE (&certfile); } fflush (fpout); @@ -1256,7 +1256,7 @@ int smime_verify_sender(HEADER *h) else retval = 0; mutt_unlink(certfile); - safe_free((void **)&certfile); + FREE (&certfile); } else mutt_any_key_to_continue(_("no certfile")); @@ -1682,7 +1682,7 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) if (linelen && !mutt_strcasecmp (line, "verification successful")) badsig = 0; - safe_free ((void **) &line); + FREE (&line); } } @@ -1900,7 +1900,7 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile) line = mutt_read_line (line, &linelen, smimeerr, &lineno); if (linelen && !mutt_strcasecmp (line, "verification successful")) m->goodsig = 1; - safe_free ((void **) &line); + FREE (&line); } else { m->goodsig = p->goodsig; diff --git a/thread.c b/thread.c index af36fb3e..d2a08408 100644 --- a/thread.c +++ b/thread.c @@ -135,7 +135,7 @@ static void calculate_visibility (CONTEXT *ctx, int *max_depth) tree->subtree_visible = 0; if (tree->message) { - safe_free ((void **) &tree->message->tree); + FREE (&tree->message->tree); if (VISIBLE (tree->message, ctx)) { tree->deep = 1; @@ -331,8 +331,8 @@ void mutt_draw_tree (CONTEXT *ctx) while (!tree->deep); } - safe_free ((void **) &pfx); - safe_free ((void **) &arrow); + FREE (&pfx); + FREE (&arrow); } /* since we may be trying to attach as a pseudo-thread a THREAD that @@ -439,7 +439,7 @@ static THREAD *find_subject (CONTEXT *ctx, THREAD *cur) oldlist = subjects; subjects = subjects->next; - safe_free ((void **) &oldlist); + FREE (&oldlist); } return (last); } @@ -696,7 +696,7 @@ THREAD *mutt_sort_subthreads (THREAD *thread, int init) else { Sort ^= SORT_REVERSE; - safe_free ((void **) &array); + FREE (&array); return (top); } } diff --git a/url.c b/url.c index f9fcaf6a..a1e51d2e 100644 --- a/url.c +++ b/url.c @@ -246,7 +246,7 @@ int url_parse_mailto (ENVELOPE *e, char **body, const char *src) } } - safe_free ((void **) &tmp); + FREE (&tmp); return 0; }