=================================================================== RCS file: /cvs/mandoc/mdoc.c,v retrieving revision 1.191 retrieving revision 1.196 diff -u -p -r1.191 -r1.196 --- mandoc/mdoc.c 2011/07/25 15:37:00 1.191 +++ mandoc/mdoc.c 2011/09/30 00:13:28 1.196 @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.191 2011/07/25 15:37:00 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.196 2011/09/30 00:13:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -97,7 +97,9 @@ static struct mdoc_node *node_alloc(struct mdoc *, int enum mdoct, enum mdoc_type); static int node_append(struct mdoc *, struct mdoc_node *); +#if 0 static int mdoc_preptext(struct mdoc *, int, char *, int); +#endif static int mdoc_ptext(struct mdoc *, int, char *, int); static int mdoc_pmacro(struct mdoc *, int, char *, int); @@ -158,6 +160,7 @@ mdoc_alloc1(struct mdoc *mdoc) mdoc->last = mandoc_calloc(1, sizeof(struct mdoc_node)); mdoc->first = mdoc->last; mdoc->last->type = MDOC_ROOT; + mdoc->last->tok = MDOC_MAX; mdoc->next = MDOC_NEXT_CHILD; } @@ -300,7 +303,7 @@ mdoc_parseln(struct mdoc *m, int ln, char *buf, int of return(mandoc_getcontrol(buf, &offs) ? mdoc_pmacro(m, ln, buf, offs) : - mdoc_preptext(m, ln, buf, offs)); + mdoc_ptext(m, ln, buf, offs)); } int @@ -566,17 +569,10 @@ int mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p) { struct mdoc_node *n; - size_t sv, len; - len = strlen(p); - n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT); - n->string = mandoc_malloc(len + 1); - sv = strlcpy(n->string, p, len + 1); + n->string = roff_strdup(m->roff, p); - /* Prohibit truncation. */ - assert(sv < len + 1); - if ( ! node_append(m, n)) return(0); @@ -651,6 +647,7 @@ mdoc_node_delete(struct mdoc *m, struct mdoc_node *p) mdoc_node_free(p); } +#if 0 /* * Pre-treat a text line. * Text lines can consist of equations, which must be handled apart from @@ -702,6 +699,7 @@ mdoc_preptext(struct mdoc *m, int line, char *buf, int return(1); } +#endif /* * Parse free-form text, that is, a line that does not begin with the @@ -755,11 +753,6 @@ mdoc_ptext(struct mdoc *m, int line, char *buf, int of ws = NULL; for (c = end = buf + offs; *c; c++) { switch (*c) { - case '-': - if (mandoc_hyph(buf + offs, c)) - *c = ASCII_HYPH; - ws = NULL; - break; case ' ': if (NULL == ws) ws = c;