=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.184 retrieving revision 1.187 diff -u -p -r1.184 -r1.187 --- mandoc/term.c 2011/04/09 15:29:40 1.184 +++ mandoc/term.c 2011/05/14 17:54:42 1.187 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.184 2011/04/09 15:29:40 kristaps Exp $ */ +/* $Id: term.c,v 1.187 2011/05/14 17:54:42 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -47,7 +47,7 @@ term_free(struct termp *p) if (p->buf) free(p->buf); if (p->symtab) - chars_free(p->symtab); + mchars_free(p->symtab); free(p); } @@ -348,11 +348,10 @@ term_vspace(struct termp *p) static void numbered(struct termp *p, const char *word, size_t len) { - const char *rhs; + char c; - rhs = chars_num2char(word, len); - if (rhs) - encode(p, rhs, 1); + if ('\0' != (c = mchars_num2char(word, len))) + encode(p, &c, 1); } @@ -362,7 +361,7 @@ spec(struct termp *p, const char *word, size_t len) const char *rhs; size_t sz; - rhs = chars_spec2str(p->symtab, word, len, &sz); + rhs = mchars_spec2str(p->symtab, word, len, &sz); if (rhs) encode(p, rhs, sz); else if (1 == len) @@ -376,7 +375,7 @@ res(struct termp *p, const char *word, size_t len) const char *rhs; size_t sz; - rhs = chars_res2str(p->symtab, word, len, &sz); + rhs = mchars_res2str(p->symtab, word, len, &sz); if (rhs) encode(p, rhs, sz); } @@ -533,7 +532,7 @@ adjbuf(struct termp *p, size_t sz) while (sz >= p->maxcols) p->maxcols <<= 2; - p->buf = mandoc_realloc(p->buf, p->maxcols); + p->buf = mandoc_realloc(p->buf, sizeof(int) * p->maxcols); } @@ -563,8 +562,8 @@ encode(struct termp *p, const char *word, size_t sz) if (TERMFONT_NONE == (f = term_fonttop(p))) { if (p->col + sz >= p->maxcols) adjbuf(p, p->col + sz); - memcpy(&p->buf[(int)p->col], word, sz); - p->col += sz; + for (i = 0; i < (int)sz; i++) + p->buf[(int)p->col++] = word[i]; return; } @@ -623,11 +622,11 @@ term_strlen(const struct termp *p, const char *cp) switch (esc) { case (ESCAPE_PREDEF): - rhs = chars_res2str + rhs = mchars_res2str (p->symtab, seq, ssz, &rsz); break; case (ESCAPE_SPECIAL): - rhs = chars_spec2str + rhs = mchars_spec2str (p->symtab, seq, ssz, &rsz); if (ssz != 1 || rhs)