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

Diff for /mandoc/mdoc.c between version 1.171 and 1.172

version 1.171, 2010/12/22 11:15:16 version 1.172, 2010/12/24 14:00:40
Line 328  node_append(struct mdoc *mdoc, struct mdoc_node *p)
Line 328  node_append(struct mdoc *mdoc, struct mdoc_node *p)
   
         p->parent->nchild++;          p->parent->nchild++;
   
           /*
            * Copy over the normalised-data pointer of our parent.  Not
            * everybody has one, but copying a null pointer is fine.
            */
   
           switch (p->type) {
           case (MDOC_BODY):
                   /* FALLTHROUGH */
           case (MDOC_TAIL):
                   /* FALLTHROUGH */
           case (MDOC_HEAD):
                   p->norm = p->parent->norm;
                   break;
           default:
                   break;
           }
   
         if ( ! mdoc_valid_pre(mdoc, p))          if ( ! mdoc_valid_pre(mdoc, p))
                 return(0);                  return(0);
   
Line 460  mdoc_block_alloc(struct mdoc *m, int line, int pos, 
Line 477  mdoc_block_alloc(struct mdoc *m, int line, int pos, 
         p->args = args;          p->args = args;
         if (p->args)          if (p->args)
                 (args->refcnt)++;                  (args->refcnt)++;
   
           switch (tok) {
           case (MDOC_Bd):
                   /* FALLTHROUGH */
           case (MDOC_Bf):
                   /* FALLTHROUGH */
           case (MDOC_Bl):
                   p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
                   break;
           default:
                   break;
           }
   
         if ( ! node_append(m, p))          if ( ! node_append(m, p))
                 return(0);                  return(0);
         m->next = MDOC_NEXT_CHILD;          m->next = MDOC_NEXT_CHILD;
Line 477  mdoc_elem_alloc(struct mdoc *m, int line, int pos, 
Line 507  mdoc_elem_alloc(struct mdoc *m, int line, int pos, 
         p->args = args;          p->args = args;
         if (p->args)          if (p->args)
                 (args->refcnt)++;                  (args->refcnt)++;
   
           switch (tok) {
           case (MDOC_An):
                   p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
                   break;
           default:
                   break;
           }
   
         if ( ! node_append(m, p))          if ( ! node_append(m, p))
                 return(0);                  return(0);
         m->next = MDOC_NEXT_CHILD;          m->next = MDOC_NEXT_CHILD;
Line 511  static void
Line 550  static void
 mdoc_node_free(struct mdoc_node *p)  mdoc_node_free(struct mdoc_node *p)
 {  {
   
         if (p->norm && 0 == --(p->norm->refcnt))          if (MDOC_BLOCK == p->type || MDOC_ELEM == p->type)
                 free(p->norm);                  free(p->norm);
   
         if (p->string)          if (p->string)
                 free(p->string);                  free(p->string);
         if (p->args)          if (p->args)
Line 608  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
Line 646  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
          */           */
   
         if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&          if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
                         LIST_column == n->norm->d.Bl.type) {                          LIST_column == n->norm->Bl.type) {
                 /* `Bl' is open without any children. */                  /* `Bl' is open without any children. */
                 m->flags |= MDOC_FREECOL;                  m->flags |= MDOC_FREECOL;
                 return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));                  return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
Line 617  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
Line 655  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
         if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&          if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
                         NULL != n->parent &&                          NULL != n->parent &&
                         MDOC_Bl == n->parent->tok &&                          MDOC_Bl == n->parent->tok &&
                         LIST_column == n->parent->norm->d.Bl.type) {                          LIST_column == n->parent->norm->Bl.type) {
                 /* `Bl' has block-level `It' children. */                  /* `Bl' has block-level `It' children. */
                 m->flags |= MDOC_FREECOL;                  m->flags |= MDOC_FREECOL;
                 return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));                  return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
Line 798  mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off
Line 836  mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off
          */           */
   
         if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&          if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
                         LIST_column == n->norm->d.Bl.type) {                          LIST_column == n->norm->Bl.type) {
                 m->flags |= MDOC_FREECOL;                  m->flags |= MDOC_FREECOL;
                 if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf))                  if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf))
                         goto err;                          goto err;
Line 814  mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off
Line 852  mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off
         if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&          if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
                         NULL != n->parent &&                          NULL != n->parent &&
                         MDOC_Bl == n->parent->tok &&                          MDOC_Bl == n->parent->tok &&
                         LIST_column == n->parent->norm->d.Bl.type) {                          LIST_column == n->parent->norm->Bl.type) {
                 m->flags |= MDOC_FREECOL;                  m->flags |= MDOC_FREECOL;
                 if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf))                  if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf))
                         goto err;                          goto err;

Legend:
Removed from v.1.171  
changed lines
  Added in v.1.172

CVSweb