-/* $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 <kristaps@bsd.lv>
*
struct man *
-man_alloc(struct regset *regs, struct mparse *parse)
+man_alloc(struct roff *roff, struct mparse *parse)
{
struct man *p;
man_hash_init();
p->parse = parse;
- p->regs = regs;
+ p->roff = roff;
man_alloc1(p);
return(p);
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);
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