[PATCH:libXpm] Fix abs() usage.

Thomas Klausner wiz at NetBSD.org
Tue Mar 18 14:57:47 PDT 2014


For long arguments, use labs().
>From Jörg Sonnenberger <joerg at NetBSD.org>

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 src/create.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/create.c b/src/create.c
index 98678d8..d013da9 100644
--- a/src/create.c
+++ b/src/create.c
@@ -347,10 +347,10 @@ SetCloseColor(
 
 	    closenesses[i].cols_index = i;
 	    closenesses[i].closeness =
-		COLOR_FACTOR * (abs((long) col->red - (long) cols[i].red)
-				+ abs((long) col->green - (long) cols[i].green)
-				+ abs((long) col->blue - (long) cols[i].blue))
-		+ BRIGHTNESS_FACTOR * abs(((long) col->red +
+		COLOR_FACTOR * (labs((long) col->red - (long) cols[i].red)
+				+ labs((long) col->green - (long) cols[i].green)
+				+ labs((long) col->blue - (long) cols[i].blue))
+		+ BRIGHTNESS_FACTOR * labs(((long) col->red +
 					   (long) col->green +
 					   (long) col->blue)
 					   - ((long) cols[i].red +
-- 
1.9.0



More information about the xorg-devel mailing list