=================================================================== RCS file: /cvs/mandoc/eqn.c,v retrieving revision 1.77 retrieving revision 1.80 diff -u -p -r1.77 -r1.80 --- mandoc/eqn.c 2017/07/14 18:18:26 1.77 +++ mandoc/eqn.c 2018/12/13 03:40:13 1.80 @@ -1,4 +1,4 @@ -/* $Id: eqn.c,v 1.77 2017/07/14 18:18:26 schwarze Exp $ */ +/* $Id: eqn.c,v 1.80 2018/12/13 03:40:13 schwarze Exp $ */ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2017 Ingo Schwarze @@ -31,7 +31,7 @@ #include "mandoc.h" #include "roff.h" #include "libmandoc.h" -#include "libroff.h" +#include "eqn_parse.h" #define EQN_NEST_MAX 128 /* maximum nesting of defines */ #define STRNEQ(p1, sz1, p2, sz2) \ @@ -284,6 +284,13 @@ enum parse_mode { MODE_TOK }; +struct eqn_def { + char *key; + size_t keysz; + char *val; + size_t valsz; +}; + static struct eqn_box *eqn_box_alloc(struct eqn_node *, struct eqn_box *); static struct eqn_box *eqn_box_makebinary(struct eqn_node *, struct eqn_box *); @@ -468,6 +475,8 @@ eqn_next(struct eqn_node *ep, enum parse_mode mode) void eqn_box_free(struct eqn_box *bp) { + if (bp == NULL) + return; if (bp->first) eqn_box_free(bp->first); @@ -717,7 +726,7 @@ next_tok: parent->bottom = mandoc_strdup("\\[ul]"); break; case EQN_TOK_BAR: - parent->top = mandoc_strdup("\\[rl]"); + parent->top = mandoc_strdup("\\[rn]"); break; case EQN_TOK_DOT: parent->top = mandoc_strdup("\\[a.]"); @@ -1091,6 +1100,9 @@ void eqn_free(struct eqn_node *p) { int i; + + if (p == NULL) + return; for (i = 0; i < (int)p->defsz; i++) { free(p->defs[i].key);