summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-21 23:57:32 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-21 23:57:32 +0000
commit5cd3cede271315b76f2569e8a445433900fc0982 (patch)
tree0f32c3ef082cf6d4faf1b40add093d3886ef5aa5 /usr.bin
parent0df795a3754147b22ec5674d41012fb22d824111 (diff)
Migrate .An to use a pointer to its data, like everybody else.
In preparation for a simpler ref-counted system for node data. From kristaps@.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/mdoc.c5
-rw-r--r--usr.bin/mandoc/mdoc.h4
-rw-r--r--usr.bin/mandoc/mdoc_term.c6
-rw-r--r--usr.bin/mandoc/mdoc_validate.c13
4 files changed, 17 insertions, 11 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 214a752b94c..f904ea1297b 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.72 2010/12/21 23:46:17 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.73 2010/12/21 23:57:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -538,6 +538,9 @@ mdoc_node_free(struct mdoc_node *p)
if (MDOC_Bf == p->tok && MDOC_HEAD == p->type)
if (p->data.Bf)
free(p->data.Bf);
+ if (MDOC_An == p->tok)
+ if (p->data.An)
+ free(p->data.An);
if (MDOC_TS == p->tok && MDOC_BLOCK == p->type)
if (p->data.TS)
tbl_free(p->data.TS);
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h
index b8510c9f625..58743e37deb 100644
--- a/usr.bin/mandoc/mdoc.h
+++ b/usr.bin/mandoc/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.37 2010/12/21 23:46:18 schwarze Exp $ */
+/* $Id: mdoc.h,v 1.38 2010/12/21 23:57:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -361,7 +361,7 @@ struct mdoc_an {
* provided, etc.
*/
union mdoc_data {
- struct mdoc_an An;
+ struct mdoc_an *An;
struct mdoc_bd *Bd;
struct mdoc_bf *Bf;
struct mdoc_bl *Bl;
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 2f05c4bc607..4889626530f 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.118 2010/12/21 23:46:18 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.119 2010/12/21 23:57:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -1116,10 +1116,10 @@ termp_an_post(DECL_ARGS)
return;
}
- if (AUTH_split == n->data.An.auth) {
+ if (AUTH_split == n->data.An->auth) {
p->flags &= ~TERMP_NOSPLIT;
p->flags |= TERMP_SPLIT;
- } else if (AUTH_nosplit == n->data.An.auth) {
+ } else if (AUTH_nosplit == n->data.An->auth) {
p->flags &= ~TERMP_SPLIT;
p->flags |= TERMP_NOSPLIT;
}
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 9d22a0f9b65..ca03cf6166a 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.79 2010/12/21 23:46:18 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.80 2010/12/21 23:57:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -908,6 +908,9 @@ pre_an(PRE_ARGS)
{
int i;
+ assert(NULL == n->data.An);
+ n->data.An = mandoc_calloc(1, sizeof(struct mdoc_an));
+
if (NULL == n->args)
return(1);
@@ -916,9 +919,9 @@ pre_an(PRE_ARGS)
n->args->argv[i].pos, MANDOCERR_IGNARGV);
if (MDOC_Split == n->args->argv[0].arg)
- n->data.An.auth = AUTH_split;
+ n->data.An->auth = AUTH_split;
else if (MDOC_Nosplit == n->args->argv[0].arg)
- n->data.An.auth = AUTH_nosplit;
+ n->data.An->auth = AUTH_nosplit;
else
abort();
@@ -1251,14 +1254,14 @@ post_an(POST_ARGS)
struct mdoc_node *np;
np = mdoc->last;
- if (AUTH__NONE != np->data.An.auth && np->child)
+ if (AUTH__NONE != np->data.An->auth && np->child)
return(eerr_eq0(mdoc));
/*
* FIXME: make this ewarn and make sure that the front-ends
* don't print the arguments.
*/
- if (AUTH__NONE != np->data.An.auth || np->child)
+ if (AUTH__NONE != np->data.An->auth || np->child)
return(1);
mdoc_nmsg(mdoc, np, MANDOCERR_NOARGS);