X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/832aff9b1fae5a0d9a39f5b311407fd6c059bd54..4bc55ae9552362c7707a31de6c34b7d27ff3dbba:/man.c diff --git a/man.c b/man.c index 50a0cf0e..52592d4a 100644 --- a/man.c +++ b/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.107 2011/03/29 08:30:49 kristaps Exp $ */ +/* $Id: man.c,v 1.111 2011/07/28 14:17:11 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * @@ -96,7 +96,7 @@ man_free(struct man *man) struct man * -man_alloc(struct regset *regs, struct mparse *parse) +man_alloc(struct roff *roff, struct mparse *parse) { struct man *p; @@ -104,7 +104,7 @@ man_alloc(struct regset *regs, struct mparse *parse) man_hash_init(); p->parse = parse; - p->regs = regs; + p->roff = roff; man_alloc1(p); return(p); @@ -320,16 +320,9 @@ int man_word_alloc(struct man *m, int line, int pos, const char *word) { struct man_node *n; - size_t sv, len; - - len = strlen(word); n = man_node_alloc(m, line, pos, MAN_TEXT, MAN_MAX); - n->string = mandoc_malloc(len + 1); - sv = strlcpy(n->string, word, len + 1); - - /* Prohibit truncation. */ - assert(sv < len + 1); + n->string = roff_strdup(m->roff, word); if ( ! man_node_append(m, n)) return(0); @@ -371,14 +364,14 @@ man_addeqn(struct man *m, const struct eqn *ep) assert( ! (MAN_HALT & m->flags)); - n = man_node_alloc(m, ep->line, ep->pos, MAN_EQN, MAN_MAX); + n = man_node_alloc(m, ep->ln, ep->pos, MAN_EQN, MAN_MAX); n->eqn = ep; if ( ! man_node_append(m, n)) return(0); m->next = MAN_NEXT_SIBLING; - return(man_descope(m, ep->line, ep->pos)); + return(man_descope(m, ep->ln, ep->pos)); } int