let m_strformat accept NULL formats.
[apps/madmutt.git] / recvattach.c
index 8d94955..1c21de7 100644 (file)
@@ -311,19 +311,19 @@ const char *mutt_attach_fmt (char *dest, ssize_t destlen,
     *dest = 0;
   }
 
     *dest = 0;
   }
 
-  if (optional)
-    m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
-  else if (flags & M_FORMAT_OPTIONAL)
-    m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
-  return (src);
+  if (flags & M_FORMAT_OPTIONAL)
+    m_strformat(dest, destlen, optional ? ifstr : elstr,
+                mutt_attach_fmt, data, 0);
+  return src;
 }
 
 }
 
-static void attach_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
+static void attach_entry(char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
 {
-  int w=(COLS-SW)>blen?blen:(COLS-SW);
-  m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt,
-                     ((ATTACHPTR **) menu->data)[num],
-                     option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
+    int w = MIN(COLS - SW, blen);
+
+    m_strformat(b, w, AttachFormat, mutt_attach_fmt,
+                ((ATTACHPTR **) menu->data)[num],
+                option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
 }
 
 int mutt_tag_attach (MUTTMENU * menu, int n, int m)
 }
 
 int mutt_tag_attach (MUTTMENU * menu, int n, int m)