summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-09-11 09:13:48 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-09-11 09:13:48 +0000
commit780afa1ca4d7f43a09dd21046f5b183f6d7a4c72 (patch)
tree6d89cc3009a9662cd1e1e84904db11d79d485beb
parent8e9925c8e3926ac4a00ffe4d857aa5e80022fb48 (diff)
downloadmandoc-780afa1ca4d7f43a09dd21046f5b183f6d7a4c72.tar.gz
Finally expand and delete the macro SCALE_VS_INIT().
It's nothing but obfuscation and only used at three places in a single file. Removing it also makes the code three lines shorter. The ugliness was already pointed out six years ago by mmcc@.
-rw-r--r--mdoc_term.c15
-rw-r--r--out.h5
2 files changed, 8 insertions, 12 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index a9d67b0c..db62ba31 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -569,8 +569,8 @@ a2width(const struct termp *p, const char *v)
end = a2roffsu(v, &su, SCALE_MAX);
if (end == NULL || *end != '\0') {
- SCALE_HS_INIT(&su, term_strlen(p, v));
- su.scale /= term_strlen(p, "0");
+ su.unit = SCALE_EN;
+ su.scale = term_strlen(p, v) / term_strlen(p, "0");
}
return term_hen(p, &su);
}
@@ -706,9 +706,9 @@ termp_it_pre(DECL_ARGS)
for (i = 0, nn = n->prev;
nn->prev && i < (int)ncols;
nn = nn->prev, i++) {
- SCALE_HS_INIT(&su,
- term_strlen(p, bl->norm->Bl.cols[i]));
- su.scale /= term_strlen(p, "0");
+ su.unit = SCALE_EN;
+ su.scale = term_strlen(p, bl->norm->Bl.cols[i]) /
+ term_strlen(p, "0");
offset += term_hen(p, &su) + dcol;
}
@@ -725,8 +725,9 @@ termp_it_pre(DECL_ARGS)
* Use the declared column widths, extended as explained
* in the preceding paragraph.
*/
- SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i]));
- su.scale /= term_strlen(p, "0");
+ su.unit = SCALE_EN;
+ su.scale = term_strlen(p, bl->norm->Bl.cols[i]) /
+ term_strlen(p, "0");
width = term_hen(p, &su) + dcol;
break;
default:
diff --git a/out.h b/out.h
index 3c9e63fc..e1f77934 100644
--- a/out.h
+++ b/out.h
@@ -57,11 +57,6 @@ struct rofftbl {
void *arg; /* passed to sulen, slen, and len */
};
-#define SCALE_HS_INIT(p, v) \
- do { (p)->unit = SCALE_EN; \
- (p)->scale = (v); } \
- while (/* CONSTCOND */ 0)
-
struct tbl_span;