shithub: neatroff

Download patch

ref: ab1be40cf7c539cb62f7bfb6537f8e1d96460ee5
parent: ab680a15958c948cde6288a0b0a1291eb184aba5
author: Sizhe Zhao <prc.zhao@outlook.com>
date: Sat Sep 4 20:22:37 EDT 2021

roff: use labs() for long integers in FMT_COST

--- a/fmt.c
+++ b/fmt.c
@@ -451,7 +451,7 @@
 static long FMT_COST(int llen, int lwid, int swid, int nspc)
 {
 	/* the ratio that the stretchable spaces of the line should be spread */
-	long ratio = abs((llen - lwid) * 100l / (swid ? swid : 1));
+	long ratio = labs((llen - lwid) * 100l / (swid ? swid : 1));
 	/* ratio too large; scaling it down */
 	if (ratio > 4000)
 		ratio = 4000 + scaledown(ratio - 4000);