aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/eqn.c b/eqn.c
index 9c3b9783..37f01bcb 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.37 2011/07/23 18:44:42 kristaps Exp $ */
+/* $Id: eqn.c,v 1.38 2011/07/25 15:37:00 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -294,8 +294,7 @@ eqn_read(struct eqn_node **epp, int ln,
*/
if (0 == strncmp(p, ".EN", 3)) {
- er = eqn_end(ep);
- *epp = NULL;
+ er = eqn_end(epp);
p += 3;
while (' ' == *p || '\t' == *p)
p++;
@@ -333,7 +332,7 @@ eqn_alloc(const char *name, int pos, int line, struct mparse *parse)
p = mandoc_calloc(1, sizeof(struct eqn_node));
- if ('\0' != *name) {
+ if (name && '\0' != *name) {
sz = strlen(name);
assert(sz);
do {
@@ -352,11 +351,15 @@ eqn_alloc(const char *name, int pos, int line, struct mparse *parse)
}
enum rofferr
-eqn_end(struct eqn_node *ep)
+eqn_end(struct eqn_node **epp)
{
+ struct eqn_node *ep;
struct eqn_box *root;
enum eqn_rest c;
+ ep = *epp;
+ *epp = NULL;
+
ep->eqn.root = mandoc_calloc(1, sizeof(struct eqn_box));
root = ep->eqn.root;