From: schwarze Date: Sun, 11 Sep 2022 09:12:47 +0000 (+0000) Subject: Finally expand and delete the macro SCALE_VS_INIT(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f463ffc6da422050ffef16ed264c10265a61582d;p=openbsd 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@. --- diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index bbb1c565d49..895649caa50 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.280 2022/08/16 17:44:53 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.281 2022/09/11 09:12:47 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020, 2022 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -567,8 +567,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); } @@ -704,9 +704,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; } @@ -723,8 +723,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/usr.bin/mandoc/out.h b/usr.bin/mandoc/out.h index fcd691ce1b6..6ad7ba5a18b 100644 --- a/usr.bin/mandoc/out.h +++ b/usr.bin/mandoc/out.h @@ -1,4 +1,4 @@ -/* $OpenBSD: out.h,v 1.25 2020/04/03 11:34:19 schwarze Exp $ */ +/* $OpenBSD: out.h,v 1.26 2022/09/11 09:12:47 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2017, 2018 Ingo Schwarze @@ -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;