=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.216 retrieving revision 1.217 diff -c -r1.216 -r1.217 *** src/usr.bin/mandoc/mdoc_validate.c 2015/10/30 19:03:36 1.216 --- src/usr.bin/mandoc/mdoc_validate.c 2016/01/08 17:48:04 1.217 *************** *** 1,7 **** ! /* $OpenBSD: mdoc_validate.c,v 1.216 2015/10/30 19:03:36 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010-2015 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any --- 1,7 ---- ! /* $OpenBSD: mdoc_validate.c,v 1.217 2016/01/08 17:48:04 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010-2016 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any *************** *** 1269,1275 **** argv = nbl->args->argv + j; i = argv->sz; ! argv->sz += nh->nchild; argv->value = mandoc_reallocarray(argv->value, argv->sz, sizeof(char *)); --- 1269,1276 ---- argv = nbl->args->argv + j; i = argv->sz; ! for (nch = nh->child; nch != NULL; nch = nch->next) ! argv->sz++; argv->value = mandoc_reallocarray(argv->value, argv->sz, sizeof(char *)); *************** *** 1282,1288 **** nnext = nch->next; roff_node_delete(NULL, nch); } - nh->nchild = 0; nh->child = NULL; } --- 1283,1288 ---- *************** *** 1343,1356 **** */ assert(nchild->prev == NULL); ! if (--nbody->nchild == 0) { ! nbody->child = NULL; nbody->last = NULL; ! assert(nnext == NULL); ! } else { ! nbody->child = nnext; nnext->prev = NULL; - } /* * Relink this child. --- 1343,1353 ---- */ assert(nchild->prev == NULL); ! nbody->child = nnext; ! if (nnext == NULL) nbody->last = NULL; ! else nnext->prev = NULL; /* * Relink this child. *************** *** 1361,1367 **** nchild->next = nblock; nblock->prev = nchild; - nparent->nchild++; if (nprev == NULL) nparent->child = nchild; else --- 1358,1363 ---- *************** *** 1679,1685 **** n = mdoc->last->child; lastname = lastsec = lastpunct = NULL; while (n != NULL) { ! if (n->tok != MDOC_Xr || n->nchild < 2) break; /* Process one .Xr node. */ --- 1675,1683 ---- n = mdoc->last->child; lastname = lastsec = lastpunct = NULL; while (n != NULL) { ! if (n->tok != MDOC_Xr || ! n->child == NULL || ! n->child->next == NULL) break; /* Process one .Xr node. */ *************** *** 1735,1741 **** { for (n = n->child; n != NULL; n = n->next) ! if ((n->tok == MDOC_An && n->nchild) || child_an(n)) return 1; return 0; } --- 1733,1739 ---- { for (n = n->child; n != NULL; n = n->next) ! if ((n->tok == MDOC_An && n->child != NULL) || child_an(n)) return 1; return 0; } *************** *** 1922,1928 **** post_prevpar(mdoc); if (np->tok == MDOC_sp) { ! if (np->nchild > 1) mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, np->child->next->line, np->child->next->pos, "sp ... %s", np->child->next->string); --- 1920,1926 ---- post_prevpar(mdoc); if (np->tok == MDOC_sp) { ! if (np->child != NULL && np->child->next != NULL) mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, np->child->next->line, np->child->next->pos, "sp ... %s", np->child->next->string);