=================================================================== RCS file: /cvs/mandoc/man.c,v retrieving revision 1.108 retrieving revision 1.112 diff -u -p -r1.108 -r1.112 --- mandoc/man.c 2011/07/18 07:46:41 1.108 +++ mandoc/man.c 2011/10/06 22:29:12 1.112 @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.108 2011/07/18 07:46:41 kristaps Exp $ */ +/* $Id: man.c,v 1.112 2011/10/06 22:29:12 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * @@ -320,17 +320,10 @@ 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); + n->string = roff_strdup(m->roff, word); - /* Prohibit truncation. */ - assert(sv < len + 1); - 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 @@ -654,4 +647,12 @@ man_node_unlink(struct man *m, struct man_node *n) if (m && m->first == n) m->first = NULL; +} + +const struct mparse * +man_mparse(const struct man *m) +{ + + assert(m && m->parse); + return(m->parse); }