m_strisempty is better, isn't it ?
authorJulien Danjou <julien@danjou.info>
Sun, 26 Nov 2006 17:52:15 +0000 (18:52 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 26 Nov 2006 18:16:58 +0000 (19:16 +0100)
Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
buffy.c
commands.c
init.c
mutt_libesmtp.c
sendlib.c

diff --git a/buffy.c b/buffy.c
index 4e21059..27396d9 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -41,7 +41,7 @@ int buffy_lookup(const char* path)
 {
     int i;
 
 {
     int i;
 
-    if (!path || !*path)
+    if (m_strisempty(path))
         return -1;
 
     for (i = 0; i < Incoming.len; i++) {
         return -1;
 
     for (i = 0; i < Incoming.len; i++) {
index d8a10d7..d24ba0c 100644 (file)
@@ -441,7 +441,7 @@ void mutt_pipe_message (HEADER * h)
 void mutt_print_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;
   }
     mutt_message (_("No printing command has been defined."));
     return;
   }
diff --git a/init.c b/init.c
index 5bc6d04..842b282 100644 (file)
--- 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);
 
 
   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);
     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 (!dst)
     return (0);
 
-  if (!val || !*val) {
+  if (m_strisempty(val)) {
     p_delete((char**) dst->data);
     return (1);
   }
     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? */
   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)
     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;
 
                               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;
     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;
 
 {
     rx_t* rx;
 
-    if (!s || !*s)
+    if (m_strisempty(s))
         return 0;
 
     if (rx_lookup(list, 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;
 
 {
     rx_t **last, *rx;
 
-    if (!pat || !*pat || !templ)
+    if (m_strisempty(pat) || !templ)
         return 0;
 
     if (!(rx = rx_compile (pat, REG_ICASE))) {
         return 0;
 
     if (!(rx = rx_compile (pat, REG_ICASE))) {
index 0ee85c4..c217298 100644 (file)
@@ -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;
 
   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;
 
       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) {
 }
 
 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);
     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;
 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) {
     return (1);
   if (m_strncmp(val, "enabled", 7) != 0 &&
       m_strncmp(val, "required", 8) != 0) {
index 4fa7f73..8ca6dfc 100644 (file)
--- 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);
 
     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;
       i = nntp_post (msg);
       unlink (msg);
       return i;