=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -p -r1.45 -r1.46 --- mandoc/man_term.c 2009/10/26 04:09:45 1.45 +++ mandoc/man_term.c 2009/10/27 08:49:44 1.46 @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.45 2009/10/26 04:09:45 kristaps Exp $ */ +/* $Id: man_term.c,v 1.46 2009/10/27 08:49:44 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -939,26 +939,19 @@ print_man_foot(struct termp *p, const struct man_meta static void -print_man_head(struct termp *p, const struct man_meta *meta) +print_man_head(struct termp *p, const struct man_meta *m) { - char *buf, *title; + char buf[BUFSIZ], title[BUFSIZ]; p->rmargin = p->maxrmargin; p->offset = 0; + buf[0] = title[0] = '\0'; - if (NULL == (buf = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); - if (NULL == (title = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); + if (m->vol) + strlcpy(buf, m->vol, BUFSIZ); - if (meta->vol) - (void)strlcpy(buf, meta->vol, p->rmargin); - else - *buf = 0; + snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); - (void)snprintf(title, p->rmargin, "%s(%d)", - meta->title, meta->msec); - p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; @@ -984,8 +977,4 @@ print_man_head(struct termp *p, const struct man_meta p->rmargin = p->maxrmargin; p->offset = 0; p->flags &= ~TERMP_NOSPACE; - - free(title); - free(buf); } -