diff options
author | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-15 05:50:19 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-15 05:50:19 +0000 |
commit | d28c055c917bb340595af7ae9850188b6613e28d (patch) | |
tree | 8e6b0eda5bb458b24366eb7cdf782af67baa45a8 | |
parent | 3848f5fd231c3df676cf07f17e4c5805c55a49cb (diff) | |
download | mandoc-d28c055c917bb340595af7ae9850188b6613e28d.tar.gz |
Cleanup indentation after moving the read buffering out of the loop.
-rw-r--r-- | main.c | 104 |
1 files changed, 51 insertions, 53 deletions
@@ -376,74 +376,72 @@ fdesc(struct curparse *curp) /* Fill buf with file blocksize. */ for (i = lnn = pos = comment = 0; i < (int)blk.sz; ++i) { - if (pos >= (int)ln.sz) { - ln.sz += 256; /* Step-size. */ - ln.buf = realloc(ln.buf, ln.sz); - if (NULL == ln.buf) { - perror(NULL); - goto bailout; - } + if (pos >= (int)ln.sz) { + ln.sz += 256; /* Step-size. */ + ln.buf = realloc(ln.buf, ln.sz); + if (NULL == ln.buf) { + perror(NULL); + goto bailout; } + } - if ('\n' != blk.buf[i]) { - if (comment) - continue; - ln.buf[pos++] = blk.buf[i]; + if ('\n' != blk.buf[i]) { + if (comment) + continue; + ln.buf[pos++] = blk.buf[i]; - /* Handle in-line `\"' comments. */ + /* Handle in-line `\"' comments. */ - if (1 == pos || '\"' != ln.buf[pos - 1]) - continue; + if (1 == pos || '\"' != ln.buf[pos - 1]) + continue; - for (j = pos - 2; j >= 0; j--) - if ('\\' != ln.buf[j]) - break; + for (j = pos - 2; j >= 0; j--) + if ('\\' != ln.buf[j]) + break; - if ( ! ((pos - 2 - j) % 2)) - continue; + if ( ! ((pos - 2 - j) % 2)) + continue; - comment = 1; - pos -= 2; - for (; pos > 0; --pos) { - if (ln.buf[pos - 1] != ' ') - break; - if (pos > 2 && ln.buf[pos - 2] == '\\') - break; - } + comment = 1; + pos -= 2; + for (; pos > 0; --pos) { + if (ln.buf[pos - 1] != ' ') + break; + if (pos > 2 && ln.buf[pos - 2] == '\\') + break; + } + continue; + } + + /* Handle escaped `\\n' newlines. */ + + if (pos > 0 && 0 == comment && '\\' == ln.buf[pos - 1]) { + for (j = pos - 1; j >= 0; j--) + if ('\\' != ln.buf[j]) + break; + if ( ! ((pos - j) % 2)) { + pos--; + lnn++; continue; - } - - /* Handle escaped `\\n' newlines. */ - - if (pos > 0 && 0 == comment && - '\\' == ln.buf[pos - 1]) { - for (j = pos - 1; j >= 0; j--) - if ('\\' != ln.buf[j]) - break; - if ( ! ((pos - j) % 2)) { - pos--; - lnn++; - continue; - } } + } - ln.buf[pos] = 0; - lnn++; + ln.buf[pos] = 0; + lnn++; - /* If unset, assign parser in pset(). */ + /* If unset, assign parser in pset(). */ - if ( ! (man || mdoc) && ! pset(ln.buf, - pos, curp, &man, &mdoc)) - goto bailout; + if ( ! (man || mdoc) && ! pset(ln.buf, pos, curp, &man, &mdoc)) + goto bailout; - pos = comment = 0; + pos = comment = 0; - /* Pass down into parsers. */ + /* Pass down into parsers. */ - if (man && ! man_parseln(man, lnn, ln.buf)) - goto bailout; - if (mdoc && ! mdoc_parseln(mdoc, lnn, ln.buf)) - goto bailout; + if (man && ! man_parseln(man, lnn, ln.buf)) + goto bailout; + if (mdoc && ! mdoc_parseln(mdoc, lnn, ln.buf)) + goto bailout; } /* NOTE a parser may not have been assigned, yet. */ |