=================================================================== RCS file: /cvs/mandoc/Attic/ascii.c,v retrieving revision 1.2 retrieving revision 1.6 diff -u -p -r1.2 -r1.6 --- mandoc/Attic/ascii.c 2009/03/17 13:35:46 1.2 +++ mandoc/Attic/ascii.c 2009/04/12 19:19:57 1.6 @@ -1,4 +1,4 @@ -/* $Id: ascii.c,v 1.2 2009/03/17 13:35:46 kristaps Exp $ */ +/* $Id: ascii.c,v 1.6 2009/04/12 19:19:57 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -26,12 +26,6 @@ #define ASCII_PRINT_HI 126 #define ASCII_PRINT_LO 32 -/* - * Lookup and hashing routines for constructing the ASCII symbol table, - * which should contain a significant portion of mdoc(7)'s special - * symbols. - */ - struct line { const char *code; const char *out; @@ -62,7 +56,7 @@ static inline int match(const struct line *, void -asciifree(void *arg) +term_asciifree(void *arg) { struct asciitab *tab; @@ -75,7 +69,7 @@ asciifree(void *arg) void * -ascii2htab(void) +term_ascii2htab(void) { struct asciitab *tab; void **htab; @@ -92,7 +86,6 @@ ascii2htab(void) if (NULL == (tab = malloc(sizeof(struct asciitab)))) err(1, "malloc"); - assert(0 == sizeof(lines) % sizeof(struct line)); len = sizeof(lines) / sizeof(struct line); if (NULL == (p = calloc((size_t)len, sizeof(struct linep)))) @@ -132,7 +125,7 @@ ascii2htab(void) const char * -a2ascii(void *arg, const char *p, size_t sz, size_t *rsz) +term_a2ascii(void *arg, const char *p, size_t sz, size_t *rsz) { struct asciitab *tab; struct linep *pp, *prev; @@ -144,7 +137,10 @@ a2ascii(void *arg, const char *p, size_t sz, size_t *r assert(p); assert(sz > 0); - assert(p[0] >= ASCII_PRINT_LO && p[0] <= ASCII_PRINT_HI); + + if (p[0] < ASCII_PRINT_LO || p[0] > ASCII_PRINT_HI) + return(NULL); + /* * Lookup the symbol in the symbol hash. See ascii2htab for the