exit mem_realloc, enters p_realloc/xrealloc.
[apps/madmutt.git] / copy.c
diff --git a/copy.c b/copy.c
index 19b3d8c..05768a3 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -23,7 +23,6 @@
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
 
-#include "lib/mem.h"
 #include "lib/str.h"
 #include "lib/debug.h"
 
@@ -156,9 +155,8 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
         if (!headers[x])
           headers[x] = this_one;
         else {
-          mem_realloc (&headers[x], str_len (headers[x]) +
-                        str_len (this_one) + sizeof (char));
-          strcat (headers[x], this_one);        /* __STRCAT_CHECKED__ */
+          p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1);
+          strcat(headers[x], this_one);        /* __STRCAT_CHECKED__ */
           p_delete(&this_one);
         }
 
@@ -226,14 +224,12 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
        * abbreviations (curline is 0), $max_display_recips is 0 and
        * while the number hasn't reached $max_display_recips yet */
       else if (curline == 0 || MaxDispRecips == 0 || ++curline <= MaxDispRecips) {
-        mem_realloc (&this_one,
-                      str_len (this_one) + str_len (buf) +
-                      sizeof (char));
+        p_realloc(&this_one, str_len(this_one) + str_len(buf) + 1);
         strcat (this_one, buf); /* __STRCAT_CHECKED__ */
       /* only for the first line which doesn't exeeds
        * $max_display_recips: abbreviate it */
       } else if (curline == MaxDispRecips+1) {
-        mem_realloc (&this_one, str_len (this_one) + 5);
+        p_realloc(&this_one, str_len(this_one) + 5);
         strcat (this_one, " ...");
       }
     }
@@ -249,8 +245,7 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
     if (!headers[x])
       headers[x] = this_one;
     else {
-      mem_realloc (&headers[x], str_len (headers[x]) +
-                    str_len (this_one) + sizeof (char));
+      p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1);
       strcat (headers[x], this_one);    /* __STRCAT_CHECKED__ */
       p_delete(&this_one);
     }
@@ -827,7 +822,7 @@ static void format_address_header (char **h, ADDRESS * a)
   buflen = linelen + 3;
 
 
-  mem_realloc (h, buflen);
+  p_realloc(h, buflen);
   for (count = 0; a; a = a->next, count++) {
     ADDRESS *tmp = a->next;
 
@@ -855,7 +850,7 @@ static void format_address_header (char **h, ADDRESS * a)
     }
 
     buflen += l + str_len (cbuf) + str_len (c2buf);
-    mem_realloc (h, buflen);
+    p_realloc(h, buflen);
     strcat (*h, cbuf);          /* __STRCAT_CHECKED__ */
     strcat (*h, buf);           /* __STRCAT_CHECKED__ */
     strcat (*h, c2buf);         /* __STRCAT_CHECKED__ */