summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-06-30 08:05:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-06-30 08:05:13 +0000
commitc7a2c1d16c7c6f95725b84acc58284816228f325 (patch)
treeeae52b970e4ed8ca4a9441f8b9cedb3f13cb8046
parente8ac047d456be99aa702c302ba49dce872afd4fe (diff)
downloadmandoc-c7a2c1d16c7c6f95725b84acc58284816228f325.tar.gz
Ouch: predefined strings moved into roff.c weren't being reinitalised
after the first parse. Do this, but note there are more efficient ways just waiting for a table of macros.
-rw-r--r--TODO3
-rw-r--r--roff.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/TODO b/TODO
index 62362107..9b307f3c 100644
--- a/TODO
+++ b/TODO
@@ -329,6 +329,9 @@ Several areas can be cleaned up to make mandoc even faster. These are
- the PDF file is HUGE: this can be reduced by using relative offsets
+- instead of re-initialising the roff predefined-strings set before each
+ parse, create a read-only version the first time and copy it
+
************************************************************************
* structural issues
************************************************************************
diff --git a/roff.c b/roff.c
index 9c9bee1e..eded5d34 100644
--- a/roff.c
+++ b/roff.c
@@ -347,8 +347,12 @@ roff_free1(struct roff *r)
void
roff_reset(struct roff *r)
{
+ int i;
roff_free1(r);
+
+ for (i = 0; i < PREDEFS_MAX; i++)
+ roff_setstr(r, predefs[i].name, predefs[i].str, 0);
}