summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mdoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-04-02 12:39:48 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-04-02 12:39:48 +0000
commit97ded0fd3ae09474f95b496ada9be448a4ec3eac (patch)
tree75efc53df86722ecd44747fff0dc9ea3be242c88 /usr.bin/mandoc/mdoc.c
parent701c2b078845c51c09de96300f02ae04dfe98d90 (diff)
merge 1.9.22, keeping local patches
* convert mdoc tokens from #define to enum * fix a segfault with .Xo/.Xc in explicit blocks * Thorn is \*(Th, not \*(TH; noticed by Joerg Sonnenberger
Diffstat (limited to 'usr.bin/mandoc/mdoc.c')
-rw-r--r--usr.bin/mandoc/mdoc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 860a6c21873..1bdf339541b 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.36 2010/03/25 02:02:28 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.37 2010/04/02 12:39:47 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -139,7 +139,7 @@ const char * const *mdoc_argnames = __mdoc_argnames;
static void mdoc_free1(struct mdoc *);
static void mdoc_alloc1(struct mdoc *);
static struct mdoc_node *node_alloc(struct mdoc *, int, int,
- int, enum mdoc_type);
+ enum mdoct, enum mdoc_type);
static int node_append(struct mdoc *,
struct mdoc_node *);
static int parsetext(struct mdoc *, int, char *);
@@ -337,9 +337,11 @@ mdoc_err(struct mdoc *m, int line, int pos, int iserr, enum merr type)
int
-mdoc_macro(struct mdoc *m, int tok,
+mdoc_macro(struct mdoc *m, enum mdoct tok,
int ln, int pp, int *pos, char *buf)
{
+
+ assert(tok < MDOC_MAX);
/*
* If we're in the prologue, deny "body" macros. Similarly, if
* we're in the body, deny prologue calls.
@@ -420,8 +422,8 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
static struct mdoc_node *
-node_alloc(struct mdoc *m, int line,
- int pos, int tok, enum mdoc_type type)
+node_alloc(struct mdoc *m, int line, int pos,
+ enum mdoct tok, enum mdoc_type type)
{
struct mdoc_node *p;
@@ -430,15 +432,14 @@ node_alloc(struct mdoc *m, int line,
p->line = line;
p->pos = pos;
p->tok = tok;
- if (MDOC_TEXT != (p->type = type))
- assert(p->tok >= 0);
+ p->type = type;
return(p);
}
int
-mdoc_tail_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_tail_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -451,7 +452,7 @@ mdoc_tail_alloc(struct mdoc *m, int line, int pos, int tok)
int
-mdoc_head_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_head_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -467,7 +468,7 @@ mdoc_head_alloc(struct mdoc *m, int line, int pos, int tok)
int
-mdoc_body_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_body_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -481,7 +482,7 @@ mdoc_body_alloc(struct mdoc *m, int line, int pos, int tok)
int
mdoc_block_alloc(struct mdoc *m, int line, int pos,
- int tok, struct mdoc_arg *args)
+ enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;
@@ -498,7 +499,7 @@ mdoc_block_alloc(struct mdoc *m, int line, int pos,
int
mdoc_elem_alloc(struct mdoc *m, int line, int pos,
- int tok, struct mdoc_arg *args)
+ enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;