summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2010-05-15 05:50:19 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2010-05-15 05:50:19 +0000
commitd28c055c917bb340595af7ae9850188b6613e28d (patch)
tree8e6b0eda5bb458b24366eb7cdf782af67baa45a8
parent3848f5fd231c3df676cf07f17e4c5805c55a49cb (diff)
downloadmandoc-d28c055c917bb340595af7ae9850188b6613e28d.tar.gz
Cleanup indentation after moving the read buffering out of the loop.
-rw-r--r--main.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/main.c b/main.c
index d071dd11..a48e920e 100644
--- a/main.c
+++ b/main.c
@@ -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. */