summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc.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/mdoc.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/mdoc.c')
-rw-r--r--usr.bin/mandoc/mdoc.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index a6b50af9e83..a89d82a4bf5 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.78 2011/01/09 13:16:48 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.79 2011/02/10 00:06:30 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -94,9 +94,6 @@ static int node_append(struct mdoc *,
struct mdoc_node *);
static int mdoc_ptext(struct mdoc *, int, char *, int);
static int mdoc_pmacro(struct mdoc *, int, char *, int);
-static int mdoc_span_alloc(struct mdoc *,
- const struct tbl_span *);
-
const struct mdoc_node *
mdoc_node(const struct mdoc *m)
@@ -223,18 +220,25 @@ mdoc_endparse(struct mdoc *m)
int
mdoc_addspan(struct mdoc *m, const struct tbl_span *sp)
{
+ struct mdoc_node *n;
assert( ! (MDOC_HALT & m->flags));
/* No text before an initial macro. */
if (SEC_NONE == m->lastnamed) {
- /* FIXME: grab from span. */
- mdoc_pmsg(m, 0, 0, MANDOCERR_NOTEXT);
+ mdoc_pmsg(m, sp->line, 0, MANDOCERR_NOTEXT);
return(1);
}
- return(mdoc_span_alloc(m, sp));
+ n = node_alloc(m, sp->line, 0, MDOC_MAX, MDOC_TBL);
+ n->span = sp;
+
+ if ( ! node_append(m, n))
+ return(0);
+
+ m->next = MDOC_NEXT_SIBLING;
+ return(1);
}
@@ -542,23 +546,6 @@ mdoc_elem_alloc(struct mdoc *m, int line, int pos,
return(1);
}
-static int
-mdoc_span_alloc(struct mdoc *m, const struct tbl_span *sp)
-{
- struct mdoc_node *n;
-
- /* FIXME: grab from tbl_span. */
- n = node_alloc(m, 0, 0, MDOC_MAX, MDOC_TBL);
- n->span = sp;
-
- if ( ! node_append(m, n))
- return(0);
-
- m->next = MDOC_NEXT_SIBLING;
- return(1);
-}
-
-
int
mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p)
{