diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-28 23:21:32 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-28 23:21:32 +0000 |
commit | 857b9aac8422fa0bebd1d83b87c8fbf4d7a1f044 (patch) | |
tree | aa5cdd5a3b077933cd75144c5f9f2357248ffd8e /mdoc_macro.c | |
parent | 4a85145c79815ddda6b35fbdacddd5665d12ac97 (diff) | |
download | mandoc-857b9aac8422fa0bebd1d83b87c8fbf4d7a1f044.tar.gz |
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 'mdoc_macro.c')
-rw-r--r-- | mdoc_macro.c | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c index 0654aa36..789aa4dc 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -843,7 +843,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; @@ -876,15 +875,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; @@ -1041,7 +1032,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; @@ -1078,16 +1068,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; @@ -1402,7 +1383,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; @@ -1437,15 +1417,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; @@ -1502,7 +1474,6 @@ in_line_eoln(MACRO_PROT_ARGS) { int la; enum margserr ac; - enum margverr av; struct mdoc_arg *arg; char *p; enum mdoct ntok; @@ -1512,20 +1483,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. */ |