summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-02-10 00:06:30 +0000
committerschwarze <schwarze@openbsd.org>2011-02-10 00:06:30 +0000
commit2733b5d3e46e90a30c22b02f02b6c634a2a8460c (patch)
tree5ade944d0eebddac3a392995e0427102f30aec05 /usr.bin/mandoc/man.c
parentClean up the COMPATIBILITY section; (diff)
downloadwireguard-openbsd-2733b5d3e46e90a30c22b02f02b6c634a2a8460c.tar.xz
wireguard-openbsd-2733b5d3e46e90a30c22b02f02b6c634a2a8460c.zip
Tbl code maintenance by kristaps@.
- Remember the line-number of a tbl_span, and use it in messages. - Put *_span_alloc() functions right into the *_addspan() ones, since these are the only places they are called from.
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r--usr.bin/mandoc/man.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index dd39e73d8ef..ece070e374c 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.54 2011/01/16 02:56:47 schwarze Exp $ */
+/* $Id: man.c,v 1.55 2011/02/10 00:06:30 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -44,8 +44,6 @@ static struct man_node *man_node_alloc(struct man *, int, int,
enum man_type, enum mant);
static int man_node_append(struct man *,
struct man_node *);
-static int man_span_alloc(struct man *,
- const struct tbl_span *);
static void man_node_free(struct man_node *);
static void man_node_unlink(struct man *,
struct man_node *);
@@ -296,22 +294,6 @@ man_block_alloc(struct man *m, int line, int pos, enum mant tok)
return(1);
}
-static int
-man_span_alloc(struct man *m, const struct tbl_span *span)
-{
- struct man_node *n;
-
- /* FIXME: grab from span */
- n = man_node_alloc(m, 0, 0, MAN_TBL, MAN_MAX);
- n->span = span;
-
- if ( ! man_node_append(m, n))
- return(0);
-
- m->next = MAN_NEXT_SIBLING;
- return(1);
-}
-
int
man_word_alloc(struct man *m, int line, int pos, const char *word)
{
@@ -364,11 +346,18 @@ man_node_delete(struct man *m, struct man_node *p)
int
man_addspan(struct man *m, const struct tbl_span *sp)
{
+ struct man_node *n;
assert( ! (MAN_HALT & m->flags));
- if ( ! man_span_alloc(m, sp))
+
+ n = man_node_alloc(m, sp->line, 0, MAN_TBL, MAN_MAX);
+ n->span = sp;
+
+ if ( ! man_node_append(m, n))
return(0);
- return(man_descope(m, 0, 0));
+
+ m->next = MAN_NEXT_SIBLING;
+ return(man_descope(m, sp->line, 0));
}
static int