From 02772d7cbebdade86dabcbbc9d19e72db2bd0b43 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 18 Jun 2009 20:46:19 +0000 Subject: Added nchild decrement in libman (not used, but better in than forgotten). Added nchild to libmdoc, deprecated count() functions in validator. --- mdoc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mdoc.c') diff --git a/mdoc.c b/mdoc.c index f2ac080d..6876d068 100644 --- a/mdoc.c +++ b/mdoc.c @@ -442,6 +442,8 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p) /* NOTREACHED */ } + p->parent->nchild++; + if ( ! mdoc_valid_pre(mdoc, p)) return(0); if ( ! mdoc_action_pre(mdoc, p)) @@ -597,6 +599,8 @@ void mdoc_node_free(struct mdoc_node *p) { + if (p->parent) + p->parent->nchild--; if (p->string) free(p->string); if (p->args) @@ -614,6 +618,7 @@ mdoc_node_freelist(struct mdoc_node *p) if (p->next) mdoc_node_freelist(p->next); + assert(0 == p->nchild); mdoc_node_free(p); } -- cgit