* mandoc: Finally expand and delete the macro SCALE_VS_INIT().
@ 2022-09-11 9:14 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2022-09-11 9:14 UTC (permalink / raw)
To: source
Log Message:
-----------
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@.
Modified Files:
--------------
mandoc:
out.h
mdoc_term.c
Revision Data
-------------
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_term.c,v
retrieving revision 1.381
retrieving revision 1.382
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.381 -r1.382
--- mdoc_term.c
+++ mdoc_term.c
@@ -569,8 +569,8 @@ a2width(const struct termp *p, const cha
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:
Index: out.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/out.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -Lout.h -Lout.h -u -p -r1.34 -r1.35
--- out.h
+++ 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;
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-11 9:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-11 9:14 mandoc: Finally expand and delete the macro SCALE_VS_INIT() schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).