diff options
author | 2014-11-28 23:20:55 +0000 | |
---|---|---|
committer | 2014-11-28 23:20:55 +0000 | |
commit | a53559d299c6168dbde75231b23b1d0d5e5eea04 (patch) | |
tree | 432dc30a7af534f411272918afef2b0a08b672f9 /usr.bin/mandoc/mdoc_macro.c | |
parent | Add some missing OpenBSD RCS markers (diff) | |
download | wireguard-openbsd-a53559d299c6168dbde75231b23b1d0d5e5eea04.tar.xz wireguard-openbsd-a53559d299c6168dbde75231b23b1d0d5e5eea04.zip |
Fold the loop around mdoc_argv() into the function itself,
it was the same in all four cases. As a bonus, get rid
of one enum type that was used for internal communication.
No functional change, minus 40 lines of code.
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 9ef75132f3c..7a847598843 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.107 2014/11/28 04:46:30 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.108 2014/11/28 23:20:55 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -841,7 +841,6 @@ static void in_line(MACRO_PROT_ARGS) { int la, scope, cnt, firstarg, mayopen, nc, nl; - enum margverr av; enum mdoct ntok; enum margserr ac; enum mdelim d; @@ -874,15 +873,7 @@ in_line(MACRO_PROT_ARGS) break; } - for (arg = NULL;; ) { - la = *pos; - av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); - if (av == ARGV_ARG) - continue; - if (av == ARGV_WORD) - *pos = la; - break; - } + mdoc_argv(mdoc, line, tok, &arg, pos, buf); d = DELIM_NONE; firstarg = 1; @@ -1039,7 +1030,6 @@ blk_full(MACRO_PROT_ARGS) struct mdoc_node *n; enum mdoct ntok; enum margserr ac, lac; - enum margverr av; char *p; nl = MDOC_NEWLINE & mdoc->flags; @@ -1076,16 +1066,7 @@ blk_full(MACRO_PROT_ARGS) * regular child nodes. */ - for (arg = NULL;; ) { - la = *pos; - av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); - if (av == ARGV_ARG) - continue; - if (av == ARGV_WORD) - *pos = la; - break; - } - + mdoc_argv(mdoc, line, tok, &arg, pos, buf); mdoc_block_alloc(mdoc, line, ppos, tok, arg); head = body = NULL; @@ -1400,7 +1381,6 @@ in_line_argn(MACRO_PROT_ARGS) { int la, flushed, j, maxargs, nl; enum margserr ac; - enum margverr av; struct mdoc_arg *arg; char *p; enum mdoct ntok; @@ -1435,15 +1415,7 @@ in_line_argn(MACRO_PROT_ARGS) break; } - for (arg = NULL; ; ) { - la = *pos; - av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); - if (av == ARGV_ARG) - continue; - if (av == ARGV_WORD) - *pos = la; - break; - } + mdoc_argv(mdoc, line, tok, &arg, pos, buf); for (flushed = j = 0; ; ) { la = *pos; @@ -1500,7 +1472,6 @@ in_line_eoln(MACRO_PROT_ARGS) { int la; enum margserr ac; - enum margverr av; struct mdoc_arg *arg; char *p; enum mdoct ntok; @@ -1510,20 +1481,7 @@ in_line_eoln(MACRO_PROT_ARGS) if (tok == MDOC_Pp) rew_sub(MDOC_BLOCK, mdoc, MDOC_Nm, line, ppos); - /* Parse macro arguments. */ - - for (arg = NULL; ; ) { - la = *pos; - av = mdoc_argv(mdoc, line, tok, &arg, pos, buf); - if (av == ARGV_ARG) - continue; - if (av == ARGV_WORD) - *pos = la; - break; - } - - /* Open element scope. */ - + mdoc_argv(mdoc, line, tok, &arg, pos, buf); mdoc_elem_alloc(mdoc, line, ppos, tok, arg); /* Parse argument terms. */ |