source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Migrate `An' to use a pointer in its data, like everybody else.
Date: Thu, 16 Dec 2010 12:14:49 -0500 (EST)	[thread overview]
Message-ID: <201012161714.oBGHEno2026388@krisdoz.my.domain> (raw)

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        mdoc.c
        mdoc.h
        mdoc_term.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.143 -r1.144
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -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);
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.198 -r1.199
--- mdoc_term.c
+++ mdoc_term.c
@@ -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;
 	}
Index: mdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -Lmdoc.h -Lmdoc.h -u -p -r1.107 -r1.108
--- mdoc.h
+++ mdoc.h
@@ -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;
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -Lmdoc.c -Lmdoc.c -u -p -r1.169 -r1.170
--- mdoc.c
+++ mdoc.c
@@ -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);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-12-16 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012161714.oBGHEno2026388@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).