X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Frcvdist.c;h=59ffdf2c5b13732e2e2b1fb3933c08373ebde12f;hp=4027ea2c76b25f9bdba02c82de9b98196d7131a0;hb=b78007de9802005825390bee71dfce2306b42519;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 4027ea2..59ffdf2 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -156,10 +156,10 @@ static char *addrcomps[] = { static void rcvdistout(FILE *inb, char *form, char *addrs) { - register int char_read = 0, format_len, i, state; - register char *tmpbuf, **nxtbuf, **ap; + int char_read = 0, format_len, i, state; + char *tmpbuf, **nxtbuf, **ap; char *cp, *scanl, name[NAMESZ]; - register struct comp *cptr, **savecomp; + struct comp *cptr, **savecomp; FILE *out; if (!(out = fopen(drft, "w"))) { @@ -170,20 +170,13 @@ rcvdistout(FILE *inb, char *form, char *addrs) cp = new_fs(form ? form : rcvdistcomps, NULL); format_len = strlen(cp); ncomps = fmt_compile(cp, &fmt) + 1; - if (!(nxtbuf = compbuffers = - (char **) calloc((size_t) ncomps, sizeof(char *)))) { - adios(EX_OSERR, NULL, "unable to allocate component buffers"); - } - if (!(savecomp = used_buf = - (struct comp **) calloc((size_t) (ncomps + 1), - sizeof(struct comp *)))) { - adios(EX_OSERR, NULL, "unable to allocate component buffer stack"); - } + nxtbuf = compbuffers = mh_xcalloc(ncomps, sizeof(char *)); + savecomp = used_buf = mh_xcalloc(ncomps + 1, sizeof(struct comp *)); savecomp += ncomps + 1; *--savecomp = 0; for (i = ncomps; i--;) { - *nxtbuf++ = mh_xmalloc(SBUFSIZ); + *nxtbuf++ = mh_xcalloc(SBUFSIZ, sizeof(char)); } nxtbuf = compbuffers; tmpbuf = *nxtbuf++; @@ -256,7 +249,7 @@ rcvdistout(FILE *inb, char *form, char *addrs) finished: ; i = format_len + char_read + 256; - scanl = mh_xmalloc((size_t) i + 2); + scanl = mh_xcalloc(i + 2, sizeof(char)); dat[0] = dat[1] = dat[2] = dat[4] = 0; dat[3] = OUTPUTLINELEN; fmt_scan(fmt, scanl, i, dat);