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

Diff for /mandoc/term.c between version 1.178 and 1.182

version 1.178, 2011/03/15 16:23:51 version 1.182, 2011/03/22 14:05:45
Line 29 
Line 29 
 #include <string.h>  #include <string.h>
   
 #include "mandoc.h"  #include "mandoc.h"
 #include "chars.h"  
 #include "out.h"  #include "out.h"
 #include "term.h"  #include "term.h"
 #include "main.h"  #include "main.h"
Line 80  term_alloc(enum termenc enc)
Line 79  term_alloc(enum termenc enc)
 {  {
         struct termp    *p;          struct termp    *p;
   
         p = calloc(1, sizeof(struct termp));          p = mandoc_calloc(1, sizeof(struct termp));
         if (NULL == p) {  
                 perror(NULL);  
                 exit((int)MANDOCLEVEL_SYSERR);  
         }  
   
         p->enc = enc;          p->enc = enc;
         return(p);          return(p);
 }  }
Line 468  term_word(struct termp *p, const char *word)
Line 462  term_word(struct termp *p, const char *word)
   
         sv = word;          sv = word;
   
         if (word[0] && '\0' == word[1])  
                 switch (word[0]) {  
                 case('.'):  
                         /* FALLTHROUGH */  
                 case(','):  
                         /* FALLTHROUGH */  
                 case(';'):  
                         /* FALLTHROUGH */  
                 case(':'):  
                         /* FALLTHROUGH */  
                 case('?'):  
                         /* FALLTHROUGH */  
                 case('!'):  
                         /* FALLTHROUGH */  
                 case(')'):  
                         /* FALLTHROUGH */  
                 case(']'):  
                         if ( ! (TERMP_IGNDELIM & p->flags))  
                                 p->flags |= TERMP_NOSPACE;  
                         break;  
                 default:  
                         break;  
                 }  
   
         if ( ! (TERMP_NOSPACE & p->flags)) {          if ( ! (TERMP_NOSPACE & p->flags)) {
                 if ( ! (TERMP_KEEP & p->flags)) {                  if ( ! (TERMP_KEEP & p->flags)) {
                         if (TERMP_PREKEEP & p->flags)                          if (TERMP_PREKEEP & p->flags)
Line 552  term_word(struct termp *p, const char *word)
Line 522  term_word(struct termp *p, const char *word)
                 if (DECO_NOSPACE == deco && '\0' == *word)                  if (DECO_NOSPACE == deco && '\0' == *word)
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
         }          }
   
         /*  
          * Note that we don't process the pipe: the parser sees it as  
          * punctuation, but we don't in terms of typography.  
          */  
         if (sv[0] && '\0' == sv[1])  
                 switch (sv[0]) {  
                 case('('):  
                         /* FALLTHROUGH */  
                 case('['):  
                         p->flags |= TERMP_NOSPACE;  
                         break;  
                 default:  
                         break;  
                 }  
 }  }
   
   
Line 579  adjbuf(struct termp *p, size_t sz)
Line 534  adjbuf(struct termp *p, size_t sz)
         while (sz >= p->maxcols)          while (sz >= p->maxcols)
                 p->maxcols <<= 2;                  p->maxcols <<= 2;
   
         p->buf = realloc(p->buf, p->maxcols);          p->buf = mandoc_realloc(p->buf, p->maxcols);
         if (NULL == p->buf) {  
                 perror(NULL);  
                 exit((int)MANDOCLEVEL_SYSERR);  
         }  
 }  }
   
   

Legend:
Removed from v.1.178  
changed lines
  Added in v.1.182

CVSweb