X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffmt_addr.c;h=d71d956cf4030a893bd79b20510583e80b16b32c;hp=782eb0a91b2ef9dbb45016b5340e5813ab93d1a9;hb=1513f7668c494c4583141d6115669b7198c14556;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/sbr/fmt_addr.c b/sbr/fmt_addr.c index 782eb0a..d71d956 100644 --- a/sbr/fmt_addr.c +++ b/sbr/fmt_addr.c @@ -3,11 +3,16 @@ * fmt_addr.c -- format an address field (from fmt_scan) * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include #include #include +#include static char *buf; /* our current working buffer */ static char *bufend; /* end of working buffer */ @@ -24,11 +29,9 @@ static unsigned int bufsiz; /* current size of buf */ int i = dst - buf;\ int n = last_dst - buf;\ bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\ - buf = realloc (buf, bufsiz);\ + buf = mh_xrealloc (buf, bufsiz);\ dst = buf + i;\ last_dst = buf + n;\ - if (! buf)\ - adios (NULL, "formataddr: couldn't get buffer space");\ bufend = buf + bufsiz;\ } @@ -59,9 +62,7 @@ formataddr (char *orig, char *str) /* if we don't have a buffer yet, get one */ if (bufsiz == 0) { - buf = malloc (BUFINCR); - if (! buf) - adios (NULL, "formataddr: couldn't allocate buffer space"); + buf = mh_xmalloc (BUFINCR); last_dst = buf; /* XXX */ bufsiz = BUFINCR - 6; /* leave some slop */ bufend = buf + bufsiz; @@ -82,7 +83,7 @@ formataddr (char *orig, char *str) } /* concatenate all the new addresses onto 'buf' */ - for (isgroup = 0; cp = getname (str); ) { + for (isgroup = 0; (cp = getname (str)); ) { if ((mp = getm (cp, NULL, 0, fmt_norm, NULL)) == NULL) continue;