diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-23 23:02:55 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-23 23:02:55 +0000 |
commit | 1a3255f2f3c16efcf38f73cc6fd89d69c831bdb9 (patch) | |
tree | dc33d2955f050ce770ed7cec7fbb15d60d60182e /usr.bin/mandoc/mdoc_action.c | |
parent | e995e7c9297b472e8ebff92fccc8cfd872b2f724 (diff) |
sync to 1.7.20: like for the -man case, add an nchild counter to the -mdoc
nodes, simplifying the validation code; no functional change
Diffstat (limited to 'usr.bin/mandoc/mdoc_action.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_action.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c index fec391c47c4..0dfe3f53303 100644 --- a/usr.bin/mandoc/mdoc_action.c +++ b/usr.bin/mandoc/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.7 2009/06/21 19:40:15 schwarze Exp $ */ +/* $Id: mdoc_action.c,v 1.8 2009/06/23 23:02:54 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -658,11 +658,9 @@ post_bl_head(POST_ARGS) * column field. Then, delete the head children. */ - for (i = 0, nn = m->last->child; nn; nn = nn->next, i++) - /* Count children. */; - - n->args->argv[c].sz = (size_t)i; - n->args->argv[c].value = malloc((size_t)i * sizeof(char *)); + n->args->argv[c].sz = (size_t)m->last->nchild; + n->args->argv[c].value = malloc + ((size_t)m->last->nchild * sizeof(char *)); for (i = 0, nn = m->last->child; nn; i++) { n->args->argv[c].value[i] = nn->string; @@ -672,7 +670,9 @@ post_bl_head(POST_ARGS) mdoc_node_free(nnp); } + m->last->nchild = 0; m->last->child = NULL; + return(1); } |