summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-04-19 14:57:16 +0000
committerschwarze <schwarze@openbsd.org>2015-04-19 14:57:16 +0000
commite32c44d44d4f28d809d0c0876ba6e1da0df21214 (patch)
tree1a4adf8046ea2a8fcb9afaa600132c91676255b4
parentBump minor, regen .pc and header (diff)
downloadwireguard-openbsd-e32c44d44d4f28d809d0c0876ba6e1da0df21214.tar.xz
wireguard-openbsd-e32c44d44d4f28d809d0c0876ba6e1da0df21214.zip
Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc() * man_block_alloc() -> roff_block_alloc() The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for now because they need to do mdoc(7)-specific argument processing.
-rw-r--r--usr.bin/mandoc/libman.h4
-rw-r--r--usr.bin/mandoc/man.c24
-rw-r--r--usr.bin/mandoc/man_macro.c9
-rw-r--r--usr.bin/mandoc/mdoc.c4
-rw-r--r--usr.bin/mandoc/mdoc_macro.c8
-rw-r--r--usr.bin/mandoc/roff.c23
-rw-r--r--usr.bin/mandoc/roff_int.h4
7 files changed, 38 insertions, 38 deletions
diff --git a/usr.bin/mandoc/libman.h b/usr.bin/mandoc/libman.h
index d8cf020c78e..dc5667943bc 100644
--- a/usr.bin/mandoc/libman.h
+++ b/usr.bin/mandoc/libman.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libman.h,v 1.50 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: libman.h,v 1.51 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,8 +36,6 @@ extern const struct man_macro *const man_macros;
__BEGIN_DECLS
-void man_block_alloc(struct roff_man *, int, int, int);
-void man_elem_alloc(struct roff_man *, int, int, int);
int man_hash_find(const char *);
void man_macroend(struct roff_man *);
void man_valid_post(struct roff_man *);
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 9ac96abed33..91ef0a1db51 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.108 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.109 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -72,26 +72,6 @@ man_parseln(struct roff_man *man, int ln, char *buf, int offs)
man_ptext(man, ln, buf, offs));
}
-void
-man_elem_alloc(struct roff_man *man, int line, int pos, int tok)
-{
- struct roff_node *p;
-
- p = roff_node_alloc(man, line, pos, ROFFT_ELEM, tok);
- roff_node_append(man, p);
- man->next = ROFF_NEXT_CHILD;
-}
-
-void
-man_block_alloc(struct roff_man *man, int line, int pos, int tok)
-{
- struct roff_node *p;
-
- p = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
- roff_node_append(man, p);
- man->next = ROFF_NEXT_CHILD;
-}
-
static void
man_descope(struct roff_man *man, int line, int offs)
{
@@ -137,7 +117,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
/* Allocate a blank entry. */
if (man->last->tok != MAN_SH &&
man->last->tok != MAN_SS) {
- man_elem_alloc(man, line, offs, MAN_sp);
+ roff_elem_alloc(man, line, offs, MAN_sp);
man->next = ROFF_NEXT_SIBLING;
}
return(1);
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index d52a9f00e61..7a9e760f12e 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_macro.c,v 1.69 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: man_macro.c,v 1.70 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -257,7 +257,7 @@ blk_exp(MACRO_PROT_ARGS)
int la;
rew_scope(man, tok);
- man_block_alloc(man, line, ppos, tok);
+ roff_block_alloc(man, line, ppos, tok);
head = roff_head_alloc(man, line, ppos, tok);
la = *pos;
@@ -287,8 +287,7 @@ blk_imp(MACRO_PROT_ARGS)
struct roff_node *n;
rew_scope(man, tok);
- man_block_alloc(man, line, ppos, tok);
- n = man->last;
+ n = roff_block_alloc(man, line, ppos, tok);
if (n->tok == MAN_SH || n->tok == MAN_SS)
man->flags &= ~MAN_LITERAL;
n = roff_head_alloc(man, line, ppos, tok);
@@ -327,7 +326,7 @@ in_line_eoln(MACRO_PROT_ARGS)
char *p;
struct roff_node *n;
- man_elem_alloc(man, line, ppos, tok);
+ roff_elem_alloc(man, line, ppos, tok);
n = man->last;
for (;;) {
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index ac35a69ab3c..dc61bc92f40 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc.c,v 1.138 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: mdoc.c,v 1.139 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -327,7 +327,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
* blank lines aren't allowed, but enough manuals assume this
* behaviour that we want to work around it.
*/
- mdoc_elem_alloc(mdoc, line, offs, MDOC_sp, NULL);
+ roff_elem_alloc(mdoc, line, offs, MDOC_sp);
mdoc->next = ROFF_NEXT_SIBLING;
mdoc_valid_post(mdoc);
return(1);
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 679cb1a7205..9b0a57c3686 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.148 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.149 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -644,7 +644,7 @@ blk_exp_close(MACRO_PROT_ARGS)
* Stray .Ec without previous .Eo:
* Break the output line, keep the arguments.
*/
- mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
+ roff_elem_alloc(mdoc, line, ppos, MDOC_br);
rew_elem(mdoc, MDOC_br);
}
} else if (endbody == NULL) {
@@ -988,7 +988,7 @@ blk_full(MACRO_PROT_ARGS)
if (tok == MDOC_It && (n == NULL || n->tok != MDOC_Bl)) {
mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse,
line, ppos, "It %s", buf + *pos);
- mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
+ roff_elem_alloc(mdoc, line, ppos, MDOC_br);
rew_elem(mdoc, MDOC_br);
return;
}
@@ -1221,7 +1221,7 @@ blk_part_exp(MACRO_PROT_ARGS)
* case of `Eo'); and a body that may be empty.
*/
- mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
+ roff_block_alloc(mdoc, line, ppos, tok);
head = NULL;
for (;;) {
la = *pos;
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index d4f3d962cdd..239783486a7 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.139 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.140 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1094,6 +1094,27 @@ roff_word_append(struct roff_man *man, const char *word)
man->next = ROFF_NEXT_SIBLING;
}
+void
+roff_elem_alloc(struct roff_man *man, int line, int pos, int tok)
+{
+ struct roff_node *n;
+
+ n = roff_node_alloc(man, line, pos, ROFFT_ELEM, tok);
+ roff_node_append(man, n);
+ man->next = ROFF_NEXT_CHILD;
+}
+
+struct roff_node *
+roff_block_alloc(struct roff_man *man, int line, int pos, int tok)
+{
+ struct roff_node *n;
+
+ n = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
+ roff_node_append(man, n);
+ man->next = ROFF_NEXT_CHILD;
+ return(n);
+}
+
struct roff_node *
roff_head_alloc(struct roff_man *man, int line, int pos, int tok)
{
diff --git a/usr.bin/mandoc/roff_int.h b/usr.bin/mandoc/roff_int.h
index 61050141cc0..ab9a8b31994 100644
--- a/usr.bin/mandoc/roff_int.h
+++ b/usr.bin/mandoc/roff_int.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_int.h,v 1.2 2015/04/19 14:25:05 schwarze Exp $ */
+/* $OpenBSD: roff_int.h,v 1.3 2015/04/19 14:57:16 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -23,6 +23,8 @@ struct roff_node *roff_node_alloc(struct roff_man *, int, int,
void roff_node_append(struct roff_man *, struct roff_node *);
void roff_word_alloc(struct roff_man *, int, int, const char *);
void roff_word_append(struct roff_man *, const char *);
+void roff_elem_alloc(struct roff_man *, int, int, int);
+struct roff_node *roff_block_alloc(struct roff_man *, int, int, int);
struct roff_node *roff_head_alloc(struct roff_man *, int, int, int);
struct roff_node *roff_body_alloc(struct roff_man *, int, int, int);
void roff_addeqn(struct roff_man *, const struct eqn *);