[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.162

version 1.160, 2011/07/27 14:23:27 version 1.162, 2011/07/27 17:25:30
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 1492  roff_setstr(struct roff *r, const char *name, const ch
Line 1497  roff_setstr(struct roff *r, const char *name, const ch
         if (NULL == n->val) {          if (NULL == n->val) {
                 n->val = mandoc_malloc(newch);                  n->val = mandoc_malloc(newch);
                 *n->val = '\0';                  *n->val = '\0';
                   n->valsz = newch - 1;
                 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, n->valsz + newch);
                   n->valsz += newch - 1;
         }          }
   
         /* Skip existing content in the destination buffer. */          /* Skip existing content in the destination buffer. */

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

CVSweb