aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-13 05:23:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-13 05:23:37 +0000
commit32c0933851c645dfc5d1af1bda32e80c9f237254 (patch)
treefab2cd59317b0b0eabad302f92f03d5eadc60c25 /eqn.c
parent41c83570cd0b176c663b583e5990f9869f214754 (diff)
downloadmandoc-32c0933851c645dfc5d1af1bda32e80c9f237254.tar.gz
mandoc-32c0933851c645dfc5d1af1bda32e80c9f237254.tar.zst
mandoc-32c0933851c645dfc5d1af1bda32e80c9f237254.zip
Cleanup, no functional change:
No need to expose the eqn(7) syntax tree data structures everywhere. Move them to their own include file, "eqn.h". While here, delete the unused enum eqn_pilet.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/eqn.c b/eqn.c
index 5f4e8ae6..2383c798 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,7 +1,7 @@
-/* $Id: eqn.c,v 1.80 2018/12/13 03:40:13 schwarze Exp $ */
+/* $Id: eqn.c,v 1.81 2018/12/13 05:23:38 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -30,6 +30,7 @@
#include "mandoc_aux.h"
#include "mandoc.h"
#include "roff.h"
+#include "eqn.h"
#include "libmandoc.h"
#include "eqn_parse.h"
@@ -491,6 +492,16 @@ eqn_box_free(struct eqn_box *bp)
free(bp);
}
+struct eqn_box *
+eqn_box_new(void)
+{
+ struct eqn_box *bp;
+
+ bp = mandoc_calloc(1, sizeof(*bp));
+ bp->expectargs = UINT_MAX;
+ return bp;
+}
+
/*
* Allocate a box as the last child of the parent node.
*/
@@ -499,10 +510,9 @@ eqn_box_alloc(struct eqn_node *ep, struct eqn_box *parent)
{
struct eqn_box *bp;
- bp = mandoc_calloc(1, sizeof(struct eqn_box));
+ bp = eqn_box_new();
bp->parent = parent;
bp->parent->args++;
- bp->expectargs = UINT_MAX;
bp->font = bp->parent->font;
bp->size = ep->gsize;