[BACK]Return to mdoc_validate.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mdoc_validate.c between version 1.300 and 1.305

version 1.300, 2015/10/30 19:04:16 version 1.305, 2016/08/10 20:17:50
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>   * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 502  post_bl_norm(POST_ARGS)
Line 502  post_bl_norm(POST_ARGS)
                 mandoc_msg(MANDOCERR_BL_NOTYPE, mdoc->parse,                  mandoc_msg(MANDOCERR_BL_NOTYPE, mdoc->parse,
                     n->line, n->pos, "Bl");                      n->line, n->pos, "Bl");
                 n->norm->Bl.type = LIST_item;                  n->norm->Bl.type = LIST_item;
                   mdoclt = MDOC_Item;
         }          }
   
         /*          /*
Line 1063  post_it(POST_ARGS)
Line 1064  post_it(POST_ARGS)
                             mdoc_argnames[nbl->args->argv[0].arg]);                              mdoc_argnames[nbl->args->argv[0].arg]);
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case LIST_item:          case LIST_item:
                 if (nit->head->child != NULL)                  if ((nch = nit->head->child) != NULL)
                         mandoc_vmsg(MANDOCERR_ARG_SKIP,                          mandoc_vmsg(MANDOCERR_ARG_SKIP,
                             mdoc->parse, nit->line, nit->pos,                              mdoc->parse, nit->line, nit->pos,
                             "It %s", nit->head->child->string);                              "It %s", nch->string == NULL ?
                               mdoc_macronames[nch->tok] : nch->string);
                 break;                  break;
         case LIST_column:          case LIST_column:
                 cols = (int)nbl->norm->Bl.ncols;                  cols = (int)nbl->norm->Bl.ncols;
Line 1278  post_bl_head(POST_ARGS)
Line 1280  post_bl_head(POST_ARGS)
   
         argv = nbl->args->argv + j;          argv = nbl->args->argv + j;
         i = argv->sz;          i = argv->sz;
         argv->sz += nh->nchild;          for (nch = nh->child; nch != NULL; nch = nch->next)
                   argv->sz++;
         argv->value = mandoc_reallocarray(argv->value,          argv->value = mandoc_reallocarray(argv->value,
             argv->sz, sizeof(char *));              argv->sz, sizeof(char *));
   
Line 1291  post_bl_head(POST_ARGS)
Line 1294  post_bl_head(POST_ARGS)
                 nnext = nch->next;                  nnext = nch->next;
                 roff_node_delete(NULL, nch);                  roff_node_delete(NULL, nch);
         }          }
         nh->nchild = 0;  
         nh->child = NULL;          nh->child = NULL;
 }  }
   
Line 1352  post_bl(POST_ARGS)
Line 1354  post_bl(POST_ARGS)
                  */                   */
   
                 assert(nchild->prev == NULL);                  assert(nchild->prev == NULL);
                 if (--nbody->nchild == 0) {                  nbody->child = nnext;
                         nbody->child = NULL;                  if (nnext == NULL)
                         nbody->last  = NULL;                          nbody->last  = NULL;
                         assert(nnext == NULL);                  else
                 } else {  
                         nbody->child = nnext;  
                         nnext->prev = NULL;                          nnext->prev = NULL;
                 }  
   
                 /*                  /*
                  * Relink this child.                   * Relink this child.
Line 1370  post_bl(POST_ARGS)
Line 1369  post_bl(POST_ARGS)
                 nchild->next   = nblock;                  nchild->next   = nblock;
   
                 nblock->prev = nchild;                  nblock->prev = nchild;
                 nparent->nchild++;  
                 if (nprev == NULL)                  if (nprev == NULL)
                         nparent->child = nchild;                          nparent->child = nchild;
                 else                  else
Line 1688  post_sh_see_also(POST_ARGS)
Line 1686  post_sh_see_also(POST_ARGS)
         n = mdoc->last->child;          n = mdoc->last->child;
         lastname = lastsec = lastpunct = NULL;          lastname = lastsec = lastpunct = NULL;
         while (n != NULL) {          while (n != NULL) {
                 if (n->tok != MDOC_Xr || n->nchild < 2)                  if (n->tok != MDOC_Xr ||
                       n->child == NULL ||
                       n->child->next == NULL)
                         break;                          break;
   
                 /* Process one .Xr node. */                  /* Process one .Xr node. */
Line 1744  child_an(const struct roff_node *n)
Line 1744  child_an(const struct roff_node *n)
 {  {
   
         for (n = n->child; n != NULL; n = n->next)          for (n = n->child; n != NULL; n = n->next)
                 if ((n->tok == MDOC_An && n->nchild) || child_an(n))                  if ((n->tok == MDOC_An && n->child != NULL) || child_an(n))
                         return 1;                          return 1;
         return 0;          return 0;
 }  }
Line 1761  post_sh_authors(POST_ARGS)
Line 1761  post_sh_authors(POST_ARGS)
 static void  static void
 post_sh_head(POST_ARGS)  post_sh_head(POST_ARGS)
 {  {
         const char      *goodsec;          struct roff_node        *nch;
         enum roff_sec    sec;          const char              *goodsec;
           enum roff_sec            sec;
   
         /*          /*
          * Process a new section.  Sections are either "named" or           * Process a new section.  Sections are either "named" or
Line 1775  post_sh_head(POST_ARGS)
Line 1776  post_sh_head(POST_ARGS)
   
         /* The NAME should be first. */          /* The NAME should be first. */
   
         if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)          if (sec != SEC_NAME && mdoc->lastnamed == SEC_NONE)
                 mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,                  mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,
                     mdoc->last->line, mdoc->last->pos,                      mdoc->last->line, mdoc->last->pos, "Sh %s",
                     "Sh %s", secnames[sec]);                      sec != SEC_CUSTOM ? secnames[sec] :
                       (nch = mdoc->last->child) == NULL ? "" :
                       nch->type == ROFFT_TEXT ? nch->string :
                       mdoc_macronames[nch->tok]);
   
         /* The SYNOPSIS gets special attention in other areas. */          /* The SYNOPSIS gets special attention in other areas. */
   
Line 1931  post_par(POST_ARGS)
Line 1935  post_par(POST_ARGS)
                 post_prevpar(mdoc);                  post_prevpar(mdoc);
   
         if (np->tok == MDOC_sp) {          if (np->tok == MDOC_sp) {
                 if (np->nchild > 1)                  if (np->child != NULL && np->child->next != NULL)
                         mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,                          mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
                             np->child->next->line, np->child->next->pos,                              np->child->next->line, np->child->next->pos,
                             "sp ... %s", np->child->next->string);                              "sp ... %s", np->child->next->string);

Legend:
Removed from v.1.300  
changed lines
  Added in v.1.305

CVSweb