=================================================================== RCS file: /cvs/mandoc/chars.c,v retrieving revision 1.5 retrieving revision 1.12 diff -u -p -r1.5 -r1.12 --- mandoc/chars.c 2009/09/22 23:34:14 1.5 +++ mandoc/chars.c 2009/11/01 07:44:32 1.12 @@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.5 2009/09/22 23:34:14 kristaps Exp $ */ +/* $Id: chars.c,v 1.12 2009/11/01 07:44:32 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -15,7 +15,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -#include +#include #include #include @@ -35,10 +35,10 @@ struct ln { int type; #define CHARS_CHAR (1 << 0) #define CHARS_STRING (1 << 1) -#define CHARS_BOTH (0x03) +#define CHARS_BOTH (CHARS_CHAR | CHARS_STRING) }; -#define LINES_MAX 302 +#define LINES_MAX 351 #define CHAR(w, x, y, z, a, b) \ { NULL, (w), (y), (a), (x), (z), (b), CHARS_CHAR }, @@ -89,13 +89,17 @@ chars_init(enum chars type) * (they're in-line re-ordered during lookup). */ - if (NULL == (tab = malloc(sizeof(struct tbl)))) - err(1, "malloc"); - tab->type = type; + tab = malloc(sizeof(struct tbl)); + if (NULL == tab) { + perror(NULL); + exit(EXIT_FAILURE); + } htab = calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **)); - if (NULL == htab) - err(1, "malloc"); + if (NULL == htab) { + perror(NULL); + exit(EXIT_FAILURE); + } for (i = 0; i < LINES_MAX; i++) { hash = (int)lines[i].code[0] - PRINT_LO; @@ -111,6 +115,7 @@ chars_init(enum chars type) } tab->htab = htab; + tab->type = type; return(tab); }