X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fap.c;h=41eae6a2274964b28422475640f542f40af57a31;hp=46c3ff5541fcd9d00253ffb9c001193b236cf4a0;hb=6e9577f324bef90765a5edc02044eb111ec48072;hpb=72795bfcbe9f7fee8927b1a4942c0230b0f857a8 diff --git a/uip/ap.c b/uip/ap.c index 46c3ff5..41eae6a 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,8 @@ static struct swit switches[] = { { NULL, 0 } }; +char *version=VERSION; + static struct format *fmt; static int dat[5]; @@ -137,15 +140,13 @@ process(char *arg, int norm) (q = &pq)->pq_next = NULL; while ((cp = getname(arg))) { - if ((p = (struct pqpair *) - mh_xcalloc((size_t) 1, sizeof(*p))) == NULL) - adios(EX_OSERR, NULL, "unable to allocate pqpair memory"); + p = mh_xcalloc(1, sizeof(*p)); if ((mp = getm(cp, NULL, 0, norm, error)) == NULL) { - p->pq_text = getcpy(cp); - p->pq_error = getcpy(error); + p->pq_text = mh_xstrdup(cp); + p->pq_error = mh_xstrdup(error); status++; } else { - p->pq_text = getcpy(mp->m_text); + p->pq_text = mh_xstrdup(mp->m_text); mnfree(mp); } q = (q->pq_next = p); @@ -162,11 +163,11 @@ process(char *arg, int norm) fmt_scan(fmt, buffer, BUFSIZ, dat); fputs(buffer, stdout); - free(p->pq_text); + mh_free0(&(p->pq_text)); if (p->pq_error) - free(p->pq_error); + mh_free0(&(p->pq_error)); q = p->pq_next; - free((char *) p); + mh_free0(&p); } return status;