some simplifications.
[apps/madmutt.git] / lib-mime / rfc822address.c
index ad4e117..a6a06c4 100644 (file)
 
 void rfc822_qualify(address_t *addr, const char *host)
 {
-    char *p;
+    if (!host)
+        return;
 
     for (; addr; addr = addr->next) {
         if (!addr->group && addr->mailbox && !strchr(addr->mailbox, '@')) {
-            p = p_new(char, m_strlen(addr->mailbox) + m_strlen(host) + 2);
+            char *p = p_new(char, m_strlen(addr->mailbox) + m_strlen(host) + 2);
             sprintf(p, "%s@%s", addr->mailbox, host);
             p_delete(&addr->mailbox);
             addr->mailbox = p;
@@ -409,14 +410,14 @@ ssize_t rfc822_write_address_single(char *buf, ssize_t buflen,
         }
 
         if (addr->personal) {
-            pos += m_strcpy(buf + pos, buflen - pos, ">");
+            pos += m_strputc(buf + pos, buflen - pos, '>');
         }
 
         if (addr->group) {
-            pos += m_strcpy(buf + pos, buflen - pos, ":");
+            pos += m_strputc(buf + pos, buflen - pos, ':');
         }
     } else {
-        pos += m_strcpy(buf + pos, buflen - pos, ";");
+        pos += m_strputc(buf + pos, buflen - pos, ';');
     }
 
     return pos;