aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit3a893fb581eb6130b6f93f519885edba4a196d5d (patch)
treef7095f409b3328619182434da1e718c736bc211d
parent2f53f5a989471121a5bf1f4a5c4d4a335b0f7fdb (diff)
downloadmandoc-3a893fb581eb6130b6f93f519885edba4a196d5d.tar.gz
mandoc-3a893fb581eb6130b6f93f519885edba4a196d5d.tar.zst
mandoc-3a893fb581eb6130b6f93f519885edba4a196d5d.zip
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--TODO5
-rw-r--r--roff.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/TODO b/TODO
index 69d0d38c..e3e08eeb 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
-* $Id: TODO,v 1.114 2011/06/29 15:38:09 kristaps Exp $
+* $Id: TODO,v 1.115 2011/06/30 08:05:13 kristaps Exp $
************************************************************************
************************************************************************
@@ -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 92a4a9b3..8f74edf0 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.142 2011/05/26 11:58:25 kristaps Exp $ */
+/* $Id: roff.c,v 1.143 2011/06/30 08:05:13 kristaps Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}