summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/out.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-20 16:44:45 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-20 16:44:45 +0000
commitf56d2a77de87d6c6c8084d18333b3f9f288b8c4b (patch)
tree7f74e9e22008ed89e57a4078654c6c4c078a6b2f /usr.bin/mandoc/out.c
parent8c82f12e94a9ffb9fe72703c36cff406a144d775 (diff)
KNF: case (FOO): -> case FOO, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
Diffstat (limited to 'usr.bin/mandoc/out.c')
-rw-r--r--usr.bin/mandoc/out.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index a281b9d744f..55cad2527e4 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.20 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: out.c,v 1.21 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -35,7 +35,8 @@ static void tblcalc_literal(struct rofftbl *, struct roffcol *,
static void tblcalc_number(struct rofftbl *, struct roffcol *,
const struct tbl_opts *, const struct tbl_dat *);
-/*
+
+/*
* Convert a `scaling unit' to a consistent form, or fail. Scaling
* units are documented in groff.7, mdoc.7, man.7.
*/
@@ -52,10 +53,10 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
i = hasd = 0;
switch (*src) {
- case ('+'):
+ case '+':
src++;
break;
- case ('-'):
+ case '-':
buf[i++] = *src++;
break;
default:
@@ -83,39 +84,39 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
buf[i] = '\0';
switch (*src) {
- case ('c'):
+ case 'c':
unit = SCALE_CM;
break;
- case ('i'):
+ case 'i':
unit = SCALE_IN;
break;
- case ('P'):
+ case 'P':
unit = SCALE_PC;
break;
- case ('p'):
+ case 'p':
unit = SCALE_PT;
break;
- case ('f'):
+ case 'f':
unit = SCALE_FS;
break;
- case ('v'):
+ case 'v':
unit = SCALE_VS;
break;
- case ('m'):
+ case 'm':
unit = SCALE_EM;
break;
- case ('\0'):
+ case '\0':
if (SCALE_MAX == def)
return(0);
unit = SCALE_BU;
break;
- case ('u'):
+ case 'u':
unit = SCALE_BU;
break;
- case ('M'):
+ case 'M':
unit = SCALE_MM;
break;
- case ('n'):
+ case 'n':
unit = SCALE_EN;
break;
default:
@@ -149,8 +150,8 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp)
*/
assert(NULL == tbl->cols);
- tbl->cols = mandoc_calloc
- ((size_t)sp->opts->cols, sizeof(struct roffcol));
+ tbl->cols = mandoc_calloc((size_t)sp->opts->cols,
+ sizeof(struct roffcol));
for ( ; sp; sp = sp->next) {
if (TBL_SPAN_DATA != sp->pos)
@@ -183,26 +184,26 @@ tblcalc_data(struct rofftbl *tbl, struct roffcol *col,
/* Branch down into data sub-types. */
switch (dp->layout->pos) {
- case (TBL_CELL_HORIZ):
+ case TBL_CELL_HORIZ:
/* FALLTHROUGH */
- case (TBL_CELL_DHORIZ):
+ case TBL_CELL_DHORIZ:
sz = (*tbl->len)(1, tbl->arg);
if (col->width < sz)
col->width = sz;
break;
- case (TBL_CELL_LONG):
+ case TBL_CELL_LONG:
/* FALLTHROUGH */
- case (TBL_CELL_CENTRE):
+ case TBL_CELL_CENTRE:
/* FALLTHROUGH */
- case (TBL_CELL_LEFT):
+ case TBL_CELL_LEFT:
/* FALLTHROUGH */
- case (TBL_CELL_RIGHT):
+ case TBL_CELL_RIGHT:
tblcalc_literal(tbl, col, dp);
break;
- case (TBL_CELL_NUMBER):
+ case TBL_CELL_NUMBER:
tblcalc_number(tbl, col, opts, dp);
break;
- case (TBL_CELL_DOWN):
+ case TBL_CELL_DOWN:
break;
default:
abort();
@@ -228,7 +229,7 @@ static void
tblcalc_number(struct rofftbl *tbl, struct roffcol *col,
const struct tbl_opts *opts, const struct tbl_dat *dp)
{
- int i;
+ int i;
size_t sz, psz, ssz, d;
const char *str;
char *cp;