From 50351aef042e302fee209e0340aaebe70eab5f9d Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 4 Aug 2018 20:04:24 +0100 Subject: [PATCH] drop unnecessary NONULL --- alias.c | 2 +- browser.c | 6 +++--- color.c | 2 +- commands.c | 2 +- complete.c | 4 ++-- compose.c | 4 ++-- edit.c | 2 +- hdrline.c | 2 +- hook.c | 4 ++-- imap/browse.c | 2 +- imap/imap.c | 2 +- main.c | 4 ++-- mutt/file.c | 2 +- mutt_account.c | 2 +- muttlib.c | 28 ++++++++++++++-------------- mx.c | 2 +- ncrypt/crypt_gpgme.c | 2 +- ncrypt/pgpkey.c | 2 +- ncrypt/smime.c | 2 +- nntp/nntp.c | 2 +- pattern.c | 2 +- pop/pop.c | 2 +- rfc1524.c | 2 +- send.c | 4 ++-- 24 files changed, 44 insertions(+), 44 deletions(-) diff --git a/alias.c b/alias.c index d414584dd..91e29980f 100644 --- a/alias.c +++ b/alias.c @@ -462,7 +462,7 @@ retry_name: TAILQ_INSERT_TAIL(&Aliases, new, entries); - mutt_str_strfcpy(buf, NONULL(AliasFile), sizeof(buf)); + mutt_str_strfcpy(buf, AliasFile, sizeof(buf)); if (mutt_get_field(_("Save to file: "), buf, sizeof(buf), MUTT_FILE) != 0) return; mutt_expand_path(buf, sizeof(buf)); diff --git a/browser.c b/browser.c index ca936f486..a424f5d3b 100644 --- a/browser.c +++ b/browser.c @@ -1456,7 +1456,7 @@ void mutt_select_file(char *file, size_t filelen, int flags, char ***files, int case MUTT_MH: case MUTT_MMDF: if (Folder) - mutt_str_strfcpy(LastDir, NONULL(Folder), sizeof(LastDir)); + mutt_str_strfcpy(LastDir, Folder, sizeof(LastDir)); else if (Spoolfile) mutt_browser_select_dir(Spoolfile); break; @@ -1671,7 +1671,7 @@ void mutt_select_file(char *file, size_t filelen, int flags, char ***files, int mutt_str_strfcpy(LastDir, OldLastDir, sizeof(LastDir)); if (examine_directory(menu, &state, LastDir, prefix) == -1) { - mutt_str_strfcpy(LastDir, NONULL(HomeDir), sizeof(LastDir)); + mutt_str_strfcpy(LastDir, HomeDir, sizeof(LastDir)); goto bail; } } @@ -1940,7 +1940,7 @@ void mutt_select_file(char *file, size_t filelen, int flags, char ***files, int case OP_ENTER_MASK: { - mutt_str_strfcpy(buf, NONULL(Mask ? Mask->pattern : NULL), sizeof(buf)); + mutt_str_strfcpy(buf, Mask ? Mask->pattern : NULL, sizeof(buf)); if (mutt_get_field(_("File Mask: "), buf, sizeof(buf), 0) != 0) break; diff --git a/color.c b/color.c index 690fef5ce..d497589de 100644 --- a/color.c +++ b/color.c @@ -755,7 +755,7 @@ static int add_pattern(struct ColorLineHead *top, const char *s, bool sensitive, if (is_index) { char buf[LONG_STRING]; - mutt_str_strfcpy(buf, NONULL(s), sizeof(buf)); + mutt_str_strfcpy(buf, s, sizeof(buf)); mutt_check_simple(buf, sizeof(buf), NONULL(SimpleSearch)); tmp->color_pattern = mutt_pattern_comp(buf, MUTT_FULL_MSG, err); if (!tmp->color_pattern) diff --git a/commands.c b/commands.c index 281f8a3b2..579d1b595 100644 --- a/commands.c +++ b/commands.c @@ -1092,7 +1092,7 @@ int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp) short structure_changed = 0; char *cp = mutt_param_get(&b->parameter, "charset"); - mutt_str_strfcpy(charset, NONULL(cp), sizeof(charset)); + mutt_str_strfcpy(charset, cp, sizeof(charset)); snprintf(buf, sizeof(buf), "%s/%s", TYPE(b), b->subtype); mutt_str_strfcpy(obuf, buf, sizeof(obuf)); diff --git a/complete.c b/complete.c index 484056e73..19b8b45ee 100644 --- a/complete.c +++ b/complete.c @@ -151,9 +151,9 @@ int mutt_complete(char *buf, size_t buflen) dirpart[0] = *buf; dirpart[1] = '\0'; if (*buf == '!') - mutt_str_strfcpy(exp_dirpart, NONULL(Spoolfile), sizeof(exp_dirpart)); + mutt_str_strfcpy(exp_dirpart, Spoolfile, sizeof(exp_dirpart)); else - mutt_str_strfcpy(exp_dirpart, NONULL(Folder), sizeof(exp_dirpart)); + mutt_str_strfcpy(exp_dirpart, Folder, sizeof(exp_dirpart)); p = strrchr(buf, '/'); if (p) { diff --git a/compose.c b/compose.c index 46c7b9cad..07f12345a 100644 --- a/compose.c +++ b/compose.c @@ -1426,7 +1426,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == MUTT_NNTP)) #endif { - mutt_str_strfcpy(fname, NONULL(Context->path), sizeof(fname)); + mutt_str_strfcpy(fname, Context->path, sizeof(fname)); mutt_pretty_mailbox(fname, sizeof(fname)); } @@ -1924,7 +1924,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, fname[0] = '\0'; if (Context) { - mutt_str_strfcpy(fname, NONULL(Context->path), sizeof(fname)); + mutt_str_strfcpy(fname, Context->path, sizeof(fname)); mutt_pretty_mailbox(fname, sizeof(fname)); } if (actx->idxlen) diff --git a/edit.c b/edit.c index 5a9b64aaa..5635774c6 100644 --- a/edit.c +++ b/edit.c @@ -92,7 +92,7 @@ static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen, tmp[sizeof(tmp) - 1] = '\0'; if (prefix) { - mutt_str_strfcpy(tmp, NONULL(IndentString), sizeof(tmp)); + mutt_str_strfcpy(tmp, IndentString, sizeof(tmp)); tmplen = mutt_str_strlen(tmp); p = tmp + tmplen; tmplen = sizeof(tmp) - tmplen; diff --git a/hdrline.c b/hdrline.c index 02001b760..976cfc520 100644 --- a/hdrline.c +++ b/hdrline.c @@ -1073,7 +1073,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co break; case 'P': - mutt_str_strfcpy(buf, NONULL(hfi->pager_progress), buflen); + mutt_str_strfcpy(buf, hfi->pager_progress, buflen); break; #ifdef USE_NNTP diff --git a/hook.c b/hook.c index 9d6860628..59bea84e1 100644 --- a/hook.c +++ b/hook.c @@ -575,10 +575,10 @@ void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr) mutt_safe_path(buf, sizeof(buf), addr); mutt_file_concat_path(path, NONULL(Folder), buf, pathlen); if (!ForceName && mx_access(path, W_OK) != 0) - mutt_str_strfcpy(path, NONULL(Record), pathlen); + mutt_str_strfcpy(path, Record, pathlen); } else - mutt_str_strfcpy(path, NONULL(Record), pathlen); + mutt_str_strfcpy(path, Record, pathlen); } mutt_pretty_mailbox(path, pathlen); } diff --git a/imap/browse.c b/imap/browse.c index 79d5d0837..188882139 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -385,7 +385,7 @@ int imap_mailbox_create(const char *folder) goto fail; } - mutt_str_strfcpy(buf, NONULL(mx.mbox), sizeof(buf)); + mutt_str_strfcpy(buf, mx.mbox, sizeof(buf)); /* append a delimiter if necessary */ n = mutt_str_strlen(buf); diff --git a/imap/imap.c b/imap/imap.c index 3611ba40e..2c7563ce4 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1814,7 +1814,7 @@ int imap_complete(char *buf, size_t buflen, char *path) imap_cmd_start(idata, tmp); /* and see what the results are */ - mutt_str_strfcpy(completion, NONULL(mx.mbox), sizeof(completion)); + mutt_str_strfcpy(completion, mx.mbox, sizeof(completion)); idata->cmdtype = IMAP_CT_LIST; idata->cmddata = &listresp; do diff --git a/main.c b/main.c index 38cda045f..1a8186303 100644 --- a/main.c +++ b/main.c @@ -1156,9 +1156,9 @@ int main(int argc, char *argv[], char *envp[]) if (!folder[0]) { if (Spoolfile) - mutt_str_strfcpy(folder, NONULL(Spoolfile), sizeof(folder)); + mutt_str_strfcpy(folder, Spoolfile, sizeof(folder)); else if (Folder) - mutt_str_strfcpy(folder, NONULL(Folder), sizeof(folder)); + mutt_str_strfcpy(folder, Folder, sizeof(folder)); /* else no folder */ } diff --git a/mutt/file.c b/mutt/file.c index 62309fc03..be24c8be6 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -93,7 +93,7 @@ static int mkwrapdir(const char *path, char *newfile, size_t nflen, char *newdir char parent[PATH_MAX]; char *p = NULL; - mutt_str_strfcpy(parent, NONULL(path), sizeof(parent)); + mutt_str_strfcpy(parent, path, sizeof(parent)); p = strrchr(parent, '/'); if (p) diff --git a/mutt_account.c b/mutt_account.c index 49afb6f28..fac54c054 100644 --- a/mutt_account.c +++ b/mutt_account.c @@ -228,7 +228,7 @@ int mutt_account_getuser(struct Account *account) { /* L10N: Example: Username at myhost.com */ snprintf(prompt, sizeof(prompt), _("Username at %s: "), account->host); - mutt_str_strfcpy(account->user, NONULL(Username), sizeof(account->user)); + mutt_str_strfcpy(account->user, Username, sizeof(account->user)); if (mutt_get_field_unbuffered(prompt, account->user, sizeof(account->user), 0)) return -1; } diff --git a/muttlib.c b/muttlib.c index 520c38660..793cdbc23 100644 --- a/muttlib.c +++ b/muttlib.c @@ -149,7 +149,7 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) { if (*(buf + 1) == '/' || *(buf + 1) == 0) { - mutt_str_strfcpy(p, NONULL(HomeDir), sizeof(p)); + mutt_str_strfcpy(p, HomeDir, sizeof(p)); tail = buf + 1; } else @@ -188,20 +188,20 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) { #ifdef USE_IMAP /* if folder = {host} or imap[s]://host/: don't append slash */ - if (mx_is_imap(NONULL(Folder)) && + if (mx_is_imap(Folder) && (Folder[strlen(Folder) - 1] == '}' || Folder[strlen(Folder) - 1] == '/')) { - mutt_str_strfcpy(p, NONULL(Folder), sizeof(p)); + mutt_str_strfcpy(p, Folder, sizeof(p)); } else #endif #ifdef USE_NOTMUCH - if (mx_is_notmuch(NONULL(Folder))) - mutt_str_strfcpy(p, NONULL(Folder), sizeof(p)); + if (mx_is_notmuch(Folder)) + mutt_str_strfcpy(p, Folder, sizeof(p)); else #endif if (Folder && *Folder && Folder[strlen(Folder) - 1] == '/') - mutt_str_strfcpy(p, NONULL(Folder), sizeof(p)); + mutt_str_strfcpy(p, Folder, sizeof(p)); else snprintf(p, sizeof(p), "%s/", NONULL(Folder)); @@ -233,14 +233,14 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) case '>': { - mutt_str_strfcpy(p, NONULL(Mbox), sizeof(p)); + mutt_str_strfcpy(p, Mbox, sizeof(p)); tail = buf + 1; } break; case '<': { - mutt_str_strfcpy(p, NONULL(Record), sizeof(p)); + mutt_str_strfcpy(p, Record, sizeof(p)); tail = buf + 1; } break; @@ -249,12 +249,12 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) { if (*(buf + 1) == '!') { - mutt_str_strfcpy(p, NONULL(LastFolder), sizeof(p)); + mutt_str_strfcpy(p, LastFolder, sizeof(p)); tail = buf + 2; } else { - mutt_str_strfcpy(p, NONULL(Spoolfile), sizeof(p)); + mutt_str_strfcpy(p, Spoolfile, sizeof(p)); tail = buf + 1; } } @@ -262,14 +262,14 @@ char *mutt_expand_path_regex(char *buf, size_t buflen, bool regex) case '-': { - mutt_str_strfcpy(p, NONULL(LastFolder), sizeof(p)); + mutt_str_strfcpy(p, LastFolder, sizeof(p)); tail = buf + 1; } break; case '^': { - mutt_str_strfcpy(p, NONULL(CurrentFolder), sizeof(p)); + mutt_str_strfcpy(p, CurrentFolder, sizeof(p)); tail = buf + 1; } break; @@ -1523,7 +1523,7 @@ void mutt_encode_path(char *buf, size_t buflen, const char *src) char *p = mutt_str_strdup(src); int rc = mutt_ch_convert_string(&p, Charset, "us-ascii", 0); /* `src' may be NULL, such as when called from the pop3 driver. */ - size_t len = mutt_str_strfcpy(buf, (rc == 0) ? NONULL(p) : NONULL(src), buflen); + size_t len = mutt_str_strfcpy(buf, (rc == 0) ? p : src, buflen); /* convert the path to POSIX "Portable Filename Character Set" */ for (size_t i = 0; i < len; ++i) @@ -1593,7 +1593,7 @@ void mutt_get_parent_path(char *path, char *buf, size_t buflen) #endif #ifdef USE_NOTMUCH if (mx_is_notmuch(path)) - mutt_str_strfcpy(buf, NONULL(Folder), buflen); + mutt_str_strfcpy(buf, Folder, buflen); else #endif { diff --git a/mx.c b/mx.c index ecd33f15f..044fab62d 100644 --- a/mx.c +++ b/mx.c @@ -748,7 +748,7 @@ int mx_mbox_close(struct Context *ctx, int *index_hint) } else { - mutt_str_strfcpy(mbox, NONULL(Mbox), sizeof(mbox)); + mutt_str_strfcpy(mbox, Mbox, sizeof(mbox)); is_spool = mutt_is_spool(ctx->path) && !mutt_is_spool(mbox); } diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 319019358..d0348d1f7 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -4727,7 +4727,7 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab { if (mutt_str_strcasecmp(whatfor, l->what) == 0) { - mutt_str_strfcpy(resp, NONULL(l->dflt), sizeof(resp)); + mutt_str_strfcpy(resp, l->dflt, sizeof(resp)); break; } } diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 3db517219..976c2d0d9 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -840,7 +840,7 @@ struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, en { if (mutt_str_strcasecmp(whatfor, l->what) == 0) { - mutt_str_strfcpy(resp, NONULL(l->dflt), sizeof(resp)); + mutt_str_strfcpy(resp, l->dflt, sizeof(resp)); break; } } diff --git a/ncrypt/smime.c b/ncrypt/smime.c index a96c48dd1..e58c5b9b3 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -239,7 +239,7 @@ static const char *fmt_smime_command(char *buf, size_t buflen, size_t col, int c char buf1[LONG_STRING], buf2[LONG_STRING]; struct stat sb; - mutt_str_strfcpy(path, NONULL(SmimeCaLocation), sizeof(path)); + mutt_str_strfcpy(path, SmimeCaLocation, sizeof(path)); mutt_expand_path(path, sizeof(path)); mutt_file_quote_filename(buf1, sizeof(buf1), path); diff --git a/nntp/nntp.c b/nntp/nntp.c index d52f90015..0fb79a005 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -368,7 +368,7 @@ static int nntp_auth(struct NntpServer *nserv) mutt_str_strfcpy(authenticators, NntpAuthenticators, sizeof(authenticators)); else if (nserv->hasCAPABILITIES) { - mutt_str_strfcpy(authenticators, NONULL(nserv->authenticators), sizeof(authenticators)); + mutt_str_strfcpy(authenticators, nserv->authenticators, sizeof(authenticators)); p = authenticators; while (*p) { diff --git a/pattern.c b/pattern.c index 90ac3a584..7265e939a 100644 --- a/pattern.c +++ b/pattern.c @@ -2211,7 +2211,7 @@ int mutt_pattern_func(int op, char *prompt) int rc = -1; struct Progress progress; - mutt_str_strfcpy(buf, NONULL(Context->pattern), sizeof(buf)); + mutt_str_strfcpy(buf, Context->pattern, sizeof(buf)); if (prompt || op != MUTT_LIMIT) if (mutt_get_field(prompt, buf, sizeof(buf), MUTT_PATTERN | MUTT_CLEAR) != 0 || !buf[0]) return -1; diff --git a/pop/pop.c b/pop/pop.c index 496c3cb0b..d2dd1cd1e 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -977,7 +977,7 @@ void pop_fetch_mail(void) goto finish; } - if (mx_mbox_open(NONULL(Spoolfile), MUTT_APPEND, &ctx) == NULL) + if (mx_mbox_open(Spoolfile, MUTT_APPEND, &ctx) == NULL) goto finish; delanswer = query_quadoption(PopDelete, _("Delete messages from server?")); diff --git a/rfc1524.c b/rfc1524.c index d65e8fe7c..b4d28d897 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -104,7 +104,7 @@ int rfc1524_expand_command(struct Body *a, char *filename, char *type, char *com param[z] = '\0'; pvalue2 = mutt_param_get(&a->parameter, param); - mutt_str_strfcpy(pvalue, NONULL(pvalue2), sizeof(pvalue)); + mutt_str_strfcpy(pvalue, pvalue2, sizeof(pvalue)); if (MailcapSanitize) mutt_file_sanitize_filename(pvalue, false); diff --git a/send.c b/send.c index 9dfdfbd80..36abcb745 100644 --- a/send.c +++ b/send.c @@ -1255,7 +1255,7 @@ struct Address *mutt_default_from(void) } else { - addr->mailbox = mutt_str_strdup(NONULL(Username)); + addr->mailbox = mutt_str_strdup(Username); } } @@ -1894,7 +1894,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile, (mutt_str_strcasecmp("plain", msg->content->subtype) == 0)) { char *p = mutt_param_get(&msg->content->parameter, "format"); - if (mutt_str_strcasecmp("flowed", NONULL(p)) != 0) + if (mutt_str_strcasecmp("flowed", p) != 0) rfc3676_space_stuff(msg); } -- 2.40.0