From: Julien Danjou Date: Sun, 26 Nov 2006 17:52:15 +0000 (+0100) Subject: m_strisempty is better, isn't it ? X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=c8e3d1cce2a8af0b4725e1a751f8795bf04487da;p=apps%2Fmadmutt.git m_strisempty is better, isn't it ? Signed-off-by: Julien Danjou Signed-off-by: Pierre Habouzit --- diff --git a/buffy.c b/buffy.c index 4e21059..27396d9 100644 --- a/buffy.c +++ b/buffy.c @@ -41,7 +41,7 @@ int buffy_lookup(const char* path) { int i; - if (!path || !*path) + if (m_strisempty(path)) return -1; for (i = 0; i < Incoming.len; i++) { diff --git a/commands.c b/commands.c index d8a10d7..d24ba0c 100644 --- a/commands.c +++ b/commands.c @@ -441,7 +441,7 @@ void mutt_pipe_message (HEADER * h) void mutt_print_message (HEADER * h) { - if (quadoption (OPT_PRINT) && (!PrintCmd || !*PrintCmd)) { + if (quadoption (OPT_PRINT) && m_strisempty(PrintCmd)) { mutt_message (_("No printing command has been defined.")); return; } diff --git a/init.c b/init.c index 5bc6d04..842b282 100644 --- a/init.c +++ b/init.c @@ -206,7 +206,7 @@ static int num_from_string (struct option_t* dst, const char* val, num = strtol (val, &t, 0); - if (!*val || *t || (short) num != num) { + if (m_strisempty(val) || *t || (short) num != num) { if (errbuf) { snprintf (errbuf, errlen, _("'%s' is invalid for $%s"), val, dst->option); @@ -289,7 +289,7 @@ static int path_from_string (struct option_t* dst, const char* val, if (!dst) return (0); - if (!val || !*val) { + if (m_strisempty(val)) { p_delete((char**) dst->data); return (1); } @@ -423,7 +423,7 @@ static int rx_from_string (struct option_t* dst, const char* val, p = (rx_t*) dst->data; /* something to do? */ - if (!val || !*val || (p->pattern && m_strcmp(p->pattern, val) == 0)) + if (m_strisempty(val) || (p->pattern && m_strcmp(p->pattern, val) == 0)) return (1); if (m_strcmp(dst->option, "mask") != 0) @@ -476,7 +476,7 @@ static int magic_from_string (struct option_t* dst, const char* val, char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) { int flag = -1; - if (!dst || !val || !*val) + if (!dst || m_strisempty(val)) return (0); if (ascii_strncasecmp (val, "mbox", 4) == 0) flag = M_MBOX; @@ -621,7 +621,7 @@ add_to_rx_list(rx_t **list, const char *s, int flags, BUFFER *err) { rx_t* rx; - if (!s || !*s) + if (m_strisempty(s)) return 0; if (rx_lookup(list, s)) @@ -642,7 +642,7 @@ static int add_to_spam_list(rx_t **list, const char *pat, { rx_t **last, *rx; - if (!pat || !*pat || !templ) + if (m_strisempty(pat) || !templ) return 0; if (!(rx = rx_compile (pat, REG_ICASE))) { diff --git a/mutt_libesmtp.c b/mutt_libesmtp.c index 0ee85c4..c217298 100644 --- a/mutt_libesmtp.c +++ b/mutt_libesmtp.c @@ -248,7 +248,7 @@ static void do_dsn_notify (smtp_message_t message, const char* from) { int flags = Notify_NOTSET; smtp_recipient_t self = NULL; - if (!DsnNotify || !*DsnNotify || !message || !from || !*from || + if (m_strisempty(DsnNotify) || !message || m_strisempty(from) || strstr (DsnNotify, "never") != NULL) return; @@ -267,7 +267,7 @@ static void do_dsn_notify (smtp_message_t message, const char* from) { } static void do_dsn_ret (smtp_message_t message) { - if (!DsnReturn || !*DsnReturn || !message) + if (m_strisempty(DsnReturn) || !message) return; if (ascii_strncasecmp (DsnReturn, "hdrs", 4) == 0) smtp_dsn_set_ret (message, Ret_HDRS); @@ -279,7 +279,7 @@ static void do_dsn_ret (smtp_message_t message) { int mutt_libesmtp_check_usetls (const char* option, unsigned long p, char* errbuf, size_t errlen) { char* val = (char*) p; - if (!val || !*val) + if (m_strisempty(val)) return (1); if (m_strncmp(val, "enabled", 7) != 0 && m_strncmp(val, "required", 8) != 0) { diff --git a/sendlib.c b/sendlib.c index 4fa7f73..8ca6dfc 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1848,7 +1848,7 @@ static int mutt_invoke_sendmail (address_t * from, /* the sender */ mutt_FormatString (cmd, sizeof (cmd), NONULL (Inews), nntp_format_str, 0, 0); - if (!*cmd) { + if (m_strisempty(cmd)) { i = nntp_post (msg); unlink (msg); return i;