/*
* 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 <h/mh.h>
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
+#include <h/utils.h>
static char *buf; /* our current working buffer */
static char *bufend; /* end of working buffer */
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;\
}
/* 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;
}
/* 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;