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

Diff for /mandoc/roff.c between version 1.160 and 1.163

version 1.160, 2011/07/27 14:23:27 version 1.163, 2011/07/27 20:55:28
Line 83  struct reg {
Line 83  struct reg {
   
 struct  roffstr {  struct  roffstr {
         char            *key; /* key of symbol */          char            *key; /* key of symbol */
           size_t           keysz;
         char            *val; /* current value */          char            *val; /* current value */
           size_t           valsz;
         struct roffstr  *next; /* next in list */          struct roffstr  *next; /* next in list */
 };  };
   
Line 496  again:
Line 498  again:
   
                 /* Replace the escape sequence by the string. */                  /* Replace the escape sequence by the string. */
   
                 pos += (stesc - *bufp);                  pos = stesc - *bufp;
   
                 nsz = *szp + strlen(res) + 1;                  nsz = *szp + strlen(res) + 1;
                 n = mandoc_malloc(nsz);                  n = mandoc_malloc(nsz);
Line 1472  roff_setstr(struct roff *r, const char *name, const ch
Line 1474  roff_setstr(struct roff *r, const char *name, const ch
                 /* Create a new string table entry. */                  /* Create a new string table entry. */
                 n = mandoc_malloc(sizeof(struct roffstr));                  n = mandoc_malloc(sizeof(struct roffstr));
                 n->key = mandoc_strdup(name);                  n->key = mandoc_strdup(name);
                   n->keysz = strlen(name);
                 n->val = NULL;                  n->val = NULL;
                   n->valsz = 0;
                 n->next = r->first_string;                  n->next = r->first_string;
                 r->first_string = n;                  r->first_string = n;
         } else if (0 == multiline) {          } else if (0 == multiline) {
                 /* In multiline mode, append; else replace. */                  /* In multiline mode, append; else replace. */
                 free(n->val);                  free(n->val);
                 n->val = NULL;                  n->val = NULL;
                   n->valsz = 0;
         }          }
   
         if (NULL == string)          if (NULL == string)
Line 1494  roff_setstr(struct roff *r, const char *name, const ch
Line 1499  roff_setstr(struct roff *r, const char *name, const ch
                 *n->val = '\0';                  *n->val = '\0';
                 oldch = 0;                  oldch = 0;
         } else {          } else {
                 oldch = strlen(n->val);                  oldch = n->valsz;
                 n->val = mandoc_realloc(n->val, oldch + newch);                  n->val = mandoc_realloc(n->val, oldch + newch);
         }          }
   
Line 1515  roff_setstr(struct roff *r, const char *name, const ch
Line 1520  roff_setstr(struct roff *r, const char *name, const ch
         /* Append terminating bytes. */          /* Append terminating bytes. */
         if (multiline)          if (multiline)
                 *c++ = '\n';                  *c++ = '\n';
   
         *c = '\0';          *c = '\0';
           n->valsz = (int)(c - n->val);
 }  }
   
 static const char *  static const char *

Legend:
Removed from v.1.160  
changed lines
  Added in v.1.163

CVSweb