aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-16 17:14:48 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-16 17:14:48 +0000
commit77c0c006eed50729949dea99a86d383f7c2941d9 (patch)
treeb7277f4b3aedb7b9467ba3bc0a1584a7905e2407
parent0ba885d297e0269ad327b1f239e814367e98e76c (diff)
downloadmandoc-77c0c006eed50729949dea99a86d383f7c2941d9.tar.gz
mandoc-77c0c006eed50729949dea99a86d383f7c2941d9.tar.zst
mandoc-77c0c006eed50729949dea99a86d383f7c2941d9.zip
Migrate `An' to use a pointer in its data, like everybody else. This is
the first step to having a simpler ref-counted system for "data" associated with a node.
-rw-r--r--mdoc.c5
-rw-r--r--mdoc.h4
-rw-r--r--mdoc_term.c6
-rw-r--r--mdoc_validate.c13
4 files changed, 17 insertions, 11 deletions
diff --git a/mdoc.c b/mdoc.c
index 38dbd72f..8e46ff49 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.169 2010/12/15 23:39:40 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.170 2010/12/16 17:14:48 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -526,6 +526,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 (p->string)
free(p->string);
diff --git a/mdoc.h b/mdoc.h
index 675e8dab..31fb0a3e 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.107 2010/12/15 23:39:40 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.108 2010/12/16 17:14:48 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -359,7 +359,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/mdoc_term.c b/mdoc_term.c
index a5de4519..8af3670a 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.198 2010/12/15 23:44:02 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.199 2010/12/16 17:14:48 kristaps 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/mdoc_validate.c b/mdoc_validate.c
index 6a65ea6d..f2eca5c6 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.143 2010/12/16 00:57:50 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.144 2010/12/16 17:14:48 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -904,6 +904,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);
@@ -912,9 +915,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();
@@ -1247,14 +1250,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);