-/* $Id: read.c,v 1.7 2011/03/28 21:49:42 kristaps Exp $ */
+/* $Id: read.c,v 1.11 2011/04/04 23:04:38 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/stat.h>
#include <sys/mman.h>
{
struct mparse *curp;
+ assert(wlevel <= MANDOCLEVEL_FATAL);
+
curp = mandoc_calloc(1, sizeof(struct mparse));
curp->wlevel = wlevel;
mparse_result(struct mparse *curp, struct mdoc **mdoc, struct man **man)
{
- *mdoc = curp->mdoc;
- *man = curp->man;
+ if (mdoc)
+ *mdoc = curp->mdoc;
+ if (man)
+ *man = curp->man;
}
void
if (level < m->wlevel)
return;
- (*m->mmsg)(er, level, m->file, ln, col, msg);
+ if (m->mmsg)
+ (*m->mmsg)(er, level, m->file, ln, col, msg);
if (m->file_status < level)
m->file_status = level;