From 9ccd8b3e4376fa371cffa2cc59bb4e395f16bf6b Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 1 Jan 2011 16:18:39 +0000 Subject: More checks for proper table exit. --- main.c | 7 ++----- roff.3 | 5 ++--- roff.c | 13 +++++++++---- roff.h | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 6b101492..d028a810 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.129 2011/01/01 15:45:18 kristaps Exp $ */ +/* $Id: main.c,v 1.130 2011/01/01 16:18:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -527,10 +527,7 @@ fdesc(struct curparse *curp) } assert(curp->roff); - if ( ! roff_endparse(curp->roff)) { - assert(MANDOCLEVEL_FATAL <= file_status); - goto cleanup; - } + roff_endparse(curp->roff); /* * With -Wstop and warnings or errors of at least diff --git a/roff.3 b/roff.3 index a52fbf61..7d8bff5c 100644 --- a/roff.3 +++ b/roff.3 @@ -1,4 +1,4 @@ -.\" $Id: roff.3,v 1.9 2011/01/01 15:45:18 kristaps Exp $ +.\" $Id: roff.3,v 1.10 2011/01/01 16:18:39 kristaps Exp $ .\" .\" Copyright (c) 2010 Kristaps Dzonsons .\" @@ -35,7 +35,7 @@ .Fa "void *data" .Fa "mandocmsg msgs" .Fc -.Ft int +.Ft void .Fn roff_endparse "struct roff *roff" .Ft void .Fn roff_free "struct roff *roff" @@ -141,7 +141,6 @@ This line should not contain the trailing newline. Returns 0 on failure, 1 on success. .It Fn roff_endparse Signals that the parse is complete. -Returns 0 on failure, 1 on success. .It Fn roff_span If .Fn roff_parseln diff --git a/roff.c b/roff.c index be1dbb47..8ea194e7 100644 --- a/roff.c +++ b/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.116 2011/01/01 16:10:40 kristaps Exp $ */ +/* $Id: roff.c,v 1.117 2011/01/01 16:18:39 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -515,15 +515,20 @@ roff_parseln(struct roff *r, int ln, char **bufp, } -int +void roff_endparse(struct roff *r) { - /* FIXME: if r->tbl */ if (r->last) (*r->msg)(MANDOCERR_SCOPEEXIT, r->data, r->last->line, r->last->col, NULL); - return(1); + + if (r->tbl) { + (*r->msg)(MANDOCERR_SCOPEEXIT, r->data, + r->tbl->line, r->tbl->pos, NULL); + tbl_end(r->tbl); + r->tbl = NULL; + } } diff --git a/roff.h b/roff.h index ce6672e6..141a469a 100644 --- a/roff.h +++ b/roff.h @@ -1,4 +1,4 @@ -/* $Id: roff.h,v 1.21 2010/12/31 18:19:43 kristaps Exp $ */ +/* $Id: roff.h,v 1.22 2011/01/01 16:18:39 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * @@ -37,7 +37,7 @@ struct roff *roff_alloc(struct regset *, void *, mandocmsg); void roff_reset(struct roff *); enum rofferr roff_parseln(struct roff *, int, char **, size_t *, int, int *); -int roff_endparse(struct roff *); +void roff_endparse(struct roff *); const struct tbl_span *roff_span(const struct roff *); __END_DECLS -- cgit v1.2.3