=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- src/usr.bin/mandoc/mdoc_term.c 2009/10/27 21:40:07 1.62 +++ src/usr.bin/mandoc/mdoc_term.c 2009/12/22 23:58:00 1.63 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.62 2009/10/27 21:40:07 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.63 2009/12/22 23:58:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -310,7 +309,7 @@ bold = p->bold; under = p->under; - bzero(&npair, sizeof(struct termpair)); + memset(&npair, 0, sizeof(struct termpair)); npair.ppair = pair; if (MDOC_TEXT != n->type) { @@ -343,8 +342,7 @@ static void print_foot(DECL_ARGS) { - char buf[DATESIZ]; - char *os; + char buf[DATESIZ], os[BUFSIZ]; /* * Output the footer in new-groff style, that is, three columns @@ -354,13 +352,9 @@ * SYSTEM DATE SYSTEM */ - if (NULL == (os = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); - time2a(m->date, buf, DATESIZ); + strlcpy(os, m->os, BUFSIZ); - (void)strlcpy(os, m->os, p->rmargin); - term_vspace(p); p->offset = 0; @@ -388,8 +382,6 @@ p->offset = 0; p->rmargin = p->maxrmargin; p->flags = 0; - - free(os); } @@ -398,16 +390,11 @@ static void print_head(DECL_ARGS) { - char *buf, *title; + char buf[BUFSIZ], title[BUFSIZ]; p->rmargin = p->maxrmargin; p->offset = 0; - if (NULL == (buf = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); - if (NULL == (title = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); - /* * The header is strange. It has three components, which are * really two with the first duplicated. It goes like this: @@ -422,15 +409,15 @@ */ assert(m->vol); - (void)strlcpy(buf, m->vol, p->rmargin); + strlcpy(buf, m->vol, BUFSIZ); if (m->arch) { - (void)strlcat(buf, " (", p->rmargin); - (void)strlcat(buf, m->arch, p->rmargin); - (void)strlcat(buf, ")", p->rmargin); + strlcat(buf, " (", BUFSIZ); + strlcat(buf, m->arch, BUFSIZ); + strlcat(buf, ")", BUFSIZ); } - snprintf(title, p->rmargin, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; @@ -457,9 +444,6 @@ p->offset = 0; p->rmargin = p->maxrmargin; p->flags &= ~TERMP_NOSPACE; - - free(title); - free(buf); }