From dca985f999af3c18f4a71b6a69e77f3cc68d060d Mon Sep 17 00:00:00 2001 From: schwarze Date: Wed, 14 Jan 2015 22:44:51 +0000 Subject: [PATCH] simplify by getting rid of ROFF_ERR in tbl(7) parsing; no functional change --- usr.bin/mandoc/libroff.h | 6 +++--- usr.bin/mandoc/tbl.c | 8 +++++--- usr.bin/mandoc/tbl_layout.c | 12 ++++++------ usr.bin/mandoc/tbl_opts.c | 7 ++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/usr.bin/mandoc/libroff.h b/usr.bin/mandoc/libroff.h index 4234f8bca08..6767a87ba0b 100644 --- a/usr.bin/mandoc/libroff.h +++ b/usr.bin/mandoc/libroff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libroff.h,v 1.11 2014/12/01 08:05:02 schwarze Exp $ */ +/* $OpenBSD: libroff.h,v 1.12 2015/01/14 22:44:51 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -69,8 +69,8 @@ void tbl_restart(int, int, struct tbl_node *); void tbl_free(struct tbl_node *); void tbl_reset(struct tbl_node *); enum rofferr tbl_read(struct tbl_node *, int, const char *, int); -int tbl_option(struct tbl_node *, int, const char *); -int tbl_layout(struct tbl_node *, int, const char *); +void tbl_option(struct tbl_node *, int, const char *); +void tbl_layout(struct tbl_node *, int, const char *); int tbl_data(struct tbl_node *, int, const char *); int tbl_cdata(struct tbl_node *, int, const char *); const struct tbl_span *tbl_span(struct tbl_node *); diff --git a/usr.bin/mandoc/tbl.c b/usr.bin/mandoc/tbl.c index 6d16d665050..91503becb34 100644 --- a/usr.bin/mandoc/tbl.c +++ b/usr.bin/mandoc/tbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl.c,v 1.11 2014/11/28 19:25:03 schwarze Exp $ */ +/* $OpenBSD: tbl.c,v 1.12 2015/01/14 22:44:51 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -53,9 +53,11 @@ tbl_read(struct tbl_node *tbl, int ln, const char *p, int offs) switch (tbl->part) { case TBL_PART_OPTS: - return(tbl_option(tbl, ln, p) ? ROFF_IGN : ROFF_ERR); + tbl_option(tbl, ln, p); + return(ROFF_IGN); case TBL_PART_LAYOUT: - return(tbl_layout(tbl, ln, p) ? ROFF_IGN : ROFF_ERR); + tbl_layout(tbl, ln, p); + return(ROFF_IGN); case TBL_PART_CDATA: return(tbl_cdata(tbl, ln, p) ? ROFF_TBL : ROFF_IGN); default: diff --git a/usr.bin/mandoc/tbl_layout.c b/usr.bin/mandoc/tbl_layout.c index 39b33648a3b..31506fb98cb 100644 --- a/usr.bin/mandoc/tbl_layout.c +++ b/usr.bin/mandoc/tbl_layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_layout.c,v 1.17 2014/11/25 05:39:00 schwarze Exp $ */ +/* $OpenBSD: tbl_layout.c,v 1.18 2015/01/14 22:44:51 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012, 2014 Ingo Schwarze @@ -297,7 +297,7 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, return(mods(tbl, cell_alloc(tbl, rp, c, vert), ln, p, pos)); } -int +void tbl_layout(struct tbl_node *tbl, int ln, const char *p) { struct tbl_row *rp; @@ -318,18 +318,18 @@ tbl_layout(struct tbl_node *tbl, int ln, const char *p) rp = NULL; continue; case '\0': /* Next row on next input line. */ - return(1); + return; case '.': /* End of layout. */ pos++; tbl->part = TBL_PART_DATA; if (tbl->first_row != NULL) - return(1); + return; mandoc_msg(MANDOCERR_TBLNOLAYOUT, tbl->parse, ln, pos, NULL); rp = mandoc_calloc(1, sizeof(*rp)); cell_alloc(tbl, rp, TBL_CELL_LEFT, 0); tbl->first_row = tbl->last_row = rp; - return(1); + return; default: /* Cell. */ break; } @@ -343,7 +343,7 @@ tbl_layout(struct tbl_node *tbl, int ln, const char *p) tbl->last_row = rp; } if ( ! cell(tbl, rp, ln, p, &pos)) - return(1); + return; } } diff --git a/usr.bin/mandoc/tbl_opts.c b/usr.bin/mandoc/tbl_opts.c index 1cef6201d53..04fb25aac76 100644 --- a/usr.bin/mandoc/tbl_opts.c +++ b/usr.bin/mandoc/tbl_opts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_opts.c,v 1.7 2014/11/28 19:25:03 schwarze Exp $ */ +/* $OpenBSD: tbl_opts.c,v 1.8 2015/01/14 22:44:51 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * @@ -250,7 +250,7 @@ again: /* /* NOTREACHED */ } -int +void tbl_option(struct tbl_node *tbl, int ln, const char *p) { int pos; @@ -263,7 +263,4 @@ tbl_option(struct tbl_node *tbl, int ln, const char *p) pos = 0; opt(tbl, ln, p, &pos); - - /* Always succeed. */ - return(1); } -- 2.20.1